I like to think of them as getter and setter methods...
Take a look at this example I did...
#include <iostream>
#include <string>
class Student
{
public:
void set(int,std::string);
void get_student_number();
void get_student_name();
private:
int student_number;
std::string student_name;
};
//setter methods
void Student::set(int a, std::string b)
{
student_number = a;
student_name = b;
}
//getter methods
void Student::get_student_number()
{
std::cout << student_number;
}
void Student::get_student_name()
{
std::cout << student_name;
}
int main()
{
Student kid;
kid.set(1232,"thwee");
kid.get_student_number();
std::cout << "\n";
kid.get_student_name();
std::cin.get();
}
[IMG]http://img476.imageshack.us/img476/5171/cut20ln.png[/IMG]
Piworld ™
[Tis simple as Pie]
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
The problem is with your power function.
You're using '^' which is the xor operator, I think.
Try swapping radius^2 with radius*radius
and const pi = 3.1415926;//global constant Pi
with double pi = 3.1415926;//global constant Pi
[IMG]http://img476.imageshack.us/img476/5171/cut20ln.png[/IMG]
Piworld ™
[Tis simple as Pie]
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439