www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS201 Assignment#03 Solution & Discussion Due Date: 13-06-2011

Views: 255

Attachments:

### Replies to This Discussion

CS201 Assignment 3 Spring 2011
#include <iostream>

#include <cmath>

#include <iomanip>
using namespace std;
int main()

{

float fAreaCircle;

float fCircumferenceCircle;
cout "\nEnter the radius of circle: "  ;

fCircumferenceCircle = (2.0 * M_PI) * radius;
cout "The area of the circle is: " fAreaCircle endl;

cout "The circumference of the circle is: " fCircumferenceCircle endl;
system("Pause");

return 0;

}

In instruction radius 3.5 is a sample output.

Sorry, Bhai Adnan Ayub ke solution mein execute kartay hoye thori si problem hai.

Correct solution is

#include <iostream>

#include <cmath>

#include <iomanip>

using namespace std;

#define PI 3.14

class Circle

{

public:

Circle();

Circle(double);

double calculateArea(double);

double calculateCircum(double);

void display();

};

Circle::Circle()

{

}

Circle::Circle(double r)

{

}

double Circle::calculateArea(double r)

{

return (PI*r*r);

}

double Circle::calculateCircum(double r)

{

return (2*PI*r);

}

void Circle::display()

{

cout "Area of the Circle is  " calculateArea(Circle::radius) endl;

cout "Circumference of the Circle is  " calculateCircum(Circle::radius) endl endl;

}

main()

{

Circle circle1;

Circle circle2(3.5);

circle1.display();

circle2.display();

system("pause");

}

Correct Solution is attached
Attachments:

which one is correct............ any one explain?

Correct Solution is attached
Attachments:
which one is correct? :(

CS201 Assingment no 3 Solution Spring 2011

Attachments:

CS201 Assignment No. 3 solution

#include<iostream.h>
#define PI 3.14
class Circle
{
public:
Circle();
Circle(double);
double calculateArea(double);
double calculateCircum(double);
void display();
};
Circle::Circle()
{
}
Circle::Circle(double r)
{
}
double Circle::calculateArea(double r)
{
return (PI*r*r);
}
double Circle::calculateCircum(double r)
{
return (2*PI*r);
}
void Circle::display()
{
cout "Area of the Circle is " calculateArea(Circle::radius) endl;
cout "Circumference of the Circle is " calculateCircum(Circle::radius) endl
endl;
}
main()
{
Circle circle1;
Circle circle2(3.5);

circle1.display();
circle2.display();
system("pause");
}
CS201 Assignment No. 3 solution

#include<iostream.h>
#define PI 3.14
class Circle
{
public:
Circle();
Circle(double);
double calculateArea(double);
double calculateCircum(double);
void display();
};
Circle::Circle()
{
}
Circle::Circle(double r)
{
}
double Circle::calculateArea(double r)
{
return (PI*r*r);
}
double Circle::calculateCircum(double r)
{
return (2*PI*r);
}
void Circle::display()
{
cout "Area of the Circle is " calculateArea(Circle::radius) endl;
cout "Circumference of the Circle is " calculateCircum(Circle::radius) endl
endl;
}
main()
{
Circle circle1;
Circle circle2(3.5);

circle1.display();
circle2.display();
system("pause");
}

#include<iostream.h>
#include <cmath>
#include <iomanip>
using namespace std;

#define PI 3.14 //definig the macro for PI

class circle //declaration of the class
{

private:

circle();
circle(float);
float circlearea(float);
float circlecircumference(float);
void display();
};

circle::circle()
{
}
circle::circle(float i)
{
}
float circle::circlearea (float i)
{
return (PI*i*i);
}

float circle::circlecircumference (float i)
{
return (2*PI*i);
}
void circle::display()
{
cout"Area of the circle is=" circlearea(circle::radius)endl;
cout"circumference of the circle is "circlecircumference(circle::radius)endl;
}

main()
{
circle circle1;
circle circle2(3.5);
circle1.display();
circle2.display();
}

1

2

3

4

5

## VIP Member Badge & Others

------------------------------------

## Latest Activity

27 minutes ago
2 hours ago
Muhammad Bilal replied to BBA(6th smes)'s discussion assignment 1 spring 2021 in the group MGT402 Cost & Management Accounting
2 hours ago
★---★ ⱮԱϚҠȺហ ȺచȺហ ★---★ updated their profile
3 hours ago
Mani Siddiqui posted a discussion

4 hours ago
5 hours ago
5 hours ago
5 hours ago