Tuesday, November 11, 2014

C++ Program for Math tutor

#include<iostream>
#include<stdlib.h>
#include<ctime>
using namespace std;

int main()
{
unsigned num1,num2,ForSeed=time(0);
int SumUser,SumCPU;
srand(ForSeed);
num1=rand();
num2=rand();
cout << "The two Random Numbers are: " << endl;
cout << num1 << endl;
cout << num2 << endl;
cout<< "Now Guess the Sum of these Numbers:\n";
cin >> SumUser;
SumCPU = num1+num2;
if(SumUser == SumCPU)

cout << "Congratulations!\nYou got the Correct answer";
else
cout << "Your Answer is incorrect! \nThe Exact Answer is: " <<SumCPU << endl;

return 0;
}

No comments:

Post a Comment