Question: PART A: #include using namespace std; class GoatNode { public: GoatNode(int kidsValue) { kids = kidsValue; } // ENTER THE MISSING PIECE OF CODE HERE
PART A:

#include
class GoatNode { public: GoatNode(int kidsValue) { kids = kidsValue; } // ENTER THE MISSING PIECE OF CODE HERE AND TEST IT IN C++ DO NOT MODIFY THE REST OF THE CODE int kids; GoatNode* next; };
int main() { GoatNode* myGoat; int inputValue;
cin >> inputValue;
myGoat = new GoatNode(inputValue); delete myGoat; return 0; }
-------------
PART B:

#include
class Triangle { public: Triangle(); void Print();
double base; double height; }; Triangle::Triangle() { base = 0.0; height = 0.0; } void Triangle::Print() { cout
int main() { double baseValue; double heightValue; // Add The Additional variable declarations go here DO NOT MODIFY THE REST OF CODE cin >> baseValue; cin >> heightValue; // ENTER THE MISSING PIECE OF CODE HERE AND TEST IT IN C++ DO NOT MODIFY THE REST OF THE CODE myTriangle->Print(); return 0; }
--------------------
Thank you >:D
Complete the GoatNode class destructor. The destructor prints "Deallocating GoatNode with ", followed by the value of kids, then " kids.". End with a newline. Ex: If the input is 4 , then the output is: Deallocating GoatNode with 4 kids. baseValue and heightValue are read from input. Declare and assign pointer myTriangle with a new Triangle object. Then, set myTriangle's base and height to baseValue and heightValue, respectively. Ex: if the input is 8.010.0, then the output is: Triangle's base: 8.0 Triangle's height: 10.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
