Question: volumeValue and temperatureValue are read from input. Declare and assign pointer myGas with a new Gas object. Then, set myGas's volume and temperature to volumeValue
volumeValue and temperatureValue are read from input. Declare and assign pointer myGas with a new Gas object. Then, set myGas's volume and temperature to volumeValue and temperatureValue, respectively.
Ex: if the input is 47 12, then the output is:
Gas's volume: 47 Gas's temperature: 12
#include
class Gas { public: Gas(); void Print();
int volume; int temperature; }; Gas::Gas() { volume = 0; temperature = 0; } void Gas::Print() { cout << "Gas's volume: " << volume << endl; cout << "Gas's temperature: " << temperature << endl; }
int main() { int volumeValue; int temperatureValue; /* Additional variable declarations go here */ cin >> volumeValue; cin >> temperatureValue; /* Your code goes here */ myGas->Print(); return 0; }
c++ and please please make it correct
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
