Hello all,
I am currently working on a homework assignment below
create a circle class that has the following member variables
radius: a double
pi: a double initialized with the value 3.14159
the class should have the following members
default constructor: sets radius to 0.0
constructor: accepts radius as argument
setRadius
getRadius
getArea: calculated as area = pi * radius * radius
getDiameter: calculated as radius * 2
getCircumference: calculated as 2 * pi * radius
write a program that demonstrates the circle class by asking a user for a radius. It should then report the area, diameter and circumference.
*my teacher has asked that i create 3 files, 1 header, 1 declaration, and one main. The problem I am having is with my main.
error is cin no operator matches '>>' operands
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include "stdafx.h"
#include "circle.h"
#include <iostream>
using namespace std;
void main()
{
cout<< "Please enter the circle's radius";
cin >> &circle::setRadius;
cout<< "the area of the circle is " << &circle::getArea << endl;
cout<< "the diameter of the circle is " << &circle::getDiameter << endl;
cout<< "the circumference of the circle is " << &circle::getCircumference << endl;
}
|