Question: C++ please I need the coressponding .cpp file created for the given .h file. I have yet to write the main function for this class

C++ please

I need the coressponding .cpp file created for the given .h file.

I have yet to write the main function for this class

Nothing given can be changed

GENERAL RESTRICTIONS

No global variables

No labels or go-to statements

No infinite loops, examples include:

for(;;)

while(1)

while(true)

do{//code}while(1);

No break statements to exit loops

C++ please I need the coressponding .cpp file created for the given

#ifndef Subtraction_h

#define Subtraction_h

#include

#include

using namespace std;

class Subtraction

{

//Overload the stream insertion and extraction operators

friend ostream& operator

public:

Subtraction();

//default constructor

//Postcondition: theAnswer=0; userResponse=0;

//invokes randomize();

void randomize();

//Function to generate two random numbers between 1 and 10.

//Postcondition: num1 and num2 are equal to between 1 and 10;

//and theAnswer = num1 - num2;

bool checkAnswer();

//Function to check userAnswer with problem answer (theAnswer)

//Postcondition: if theAnswer==userResponse appropriate feedback is displayed

// returns true if user answer is correct or returns false if user answer is incorrect;

void validate(string str1);

//Function to validate user response

//Postcondition: function accepts a string, validates it to be an int;

private:

int num1;//variable to store one of the operands

int num2;//variable to store one of the operands

int theAnswer;//variable to store the answer to the problem

int userResponse;//variable to store the user response to the problem in int format

};

#endif

1 #ifndef Subtractionh - #define Subtractionh - 4 #include 5 #include iostream 6 using namespace std; 8 class Subtraction 9 //OverLoad the stream insertion and extraction operators friend ostream& operator 5 #include iostream 6 using namespace std; 8 class Subtraction 9 //OverLoad the stream insertion and extraction operators friend ostream& operator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!