0
How can i do this?((
The challange task with class Cube, and pow, and there is surf_area and volume
5 Respuestas
0
could you be a bit more clearer with your question?
// header files: iostream, math
class Cube
{
float a; // a is side of cube
float surf_area, volume;
public:
Cube() // default constructor
{
cin>>a;
surf_area=0.0;
volume=0.0;
}
int surf_a()
{
surf_area = 6*pow(a,2);
cout<<"surface area of Cube: "<<surf_area;
return 0;
}
int vol()
{
volume = pow(a,3);
cout<<" volume of Cube: "<<volume;
return 0;
}
}
// hope this helps
0
ill check, but could you explain 2 lines, 6*pow... and pow(a,3)?))
0
@Vladyslav pow in CPP is similar to <sup><\sup> in html. now,
6*pow(a,3) means the same as 6*a*a or 6*a^2
pow(a,3) <=> a*a*a or a^3
0
no, i know, i want to now why this * to 6 and all like it
0
I suppose that the formula for surface area of a cube is 6*a^2 and that for volume is a^3