Page 1 of 1

radiusValue and heightValue are read from input. Declare and assign pointer myCone with a new Cone object. Then, set myC

Posted: Sun Jul 03, 2022 11:59 am
by answerhappygod
radiusValue and heightValue are read from input. Declare andassign pointer myCone with a new Cone object. Then, set myCone'sradius and height to radiusValue and heightValue, respectively.
Ex: if the input is 24 40, then the output is:
Cone's radius: 24 Cone's height: 40
#include <iostream>using namespace std;
class Cone { public: Cone(); void Print();
int radius; int height;};Cone::Cone() { radius = 0; height = 0;}void Cone::Print() { cout << "Cone's radius: " << radius<< endl; cout << "Cone's height: " << height<< endl;}
int main() { int radiusValue; int heightValue; /* Additional variable declarations go here */ cin >> radiusValue; cin >> heightValue; /* Your code goes here */ myCone->Print(); return 0;}