qualified id identifier declaration before (

Write your question here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

class labf
{
	private:
		double volumec;
		double volumes;
		double volumer; //cylinder
		double side; // side
		double height; //height
		double radius;
	public:
		void calcvolc(double side);
		void calcvols(double radius);
		void calcvolr(double height, double radius);
}box;


void labf::calcvols(double radius)
{
	cout << "Enter the radius of a sphere: ";
	cin >> radius;

	cout << endl;
	volumes = 1.33*pi*(pow(radius,3));

	if(radius <= 0)
 	{
		cout << "Negative numbers or 0 do not give a volume." << endl;
	}
	else
	{
	cout << "The volume of the sphere is " << volumes << endl;
	}
}
Line 24: pi is not defined

Line 18: It's a poor practice to have an argument name the same as a member variable (radius). The argument name hides the member variable.



Topic archived. No new replies allowed.