
Concept explainers
Help with C++.
Assign pointer engine1 with a new Engine object. Call engine1's Read() to read the object's data members from input. Then, call engine1's Print() to output the values of the data members. Finally, delete engine1.
Ex: If the input is 1 20, then the output is:
Engine's power: 1
Engine's temperature: 20
```
#include "memtest.h"
#include <iostream>
using namespace std;
class Engine {
public:
Engine();
void Read();
void Print();
private:
int power;
int temperature;
};
Engine::Engine() {
power = 0;
temperature = 0;
}
void Engine::Read() {
cin >> power;
cin >> temperature;
}
void Engine::Print() {
cout << "Engine's power: " << power << endl;
cout << "Engine's temperature: " << temperature << endl;
}
int main() {
Engine* engine1 = nullptr;
/* Your code goes here */
memtest(); // Check memory for testing purposes only
return 0;
}
```
to generate a solution
a solution
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT




