Well second day of class and needless to say I am more than rusty after taking a year and a half off ne how I am getting two errors when I am compiling and I can't figure them out. This calc is supposed to generate two random numbers and the user picks what he wants to do w/them and then he answers it then the program tells him if he is right or wrong.
Thanks for the help in advance :-)
double Add (double a, double b) //Addition
cout << a << " + " << b << " = ";
double Multiply (double a, double b) //Multiplcation
cout << a << " * " << b << " = ";
double Subtract (double a, double b) //Subtraction
cout << a << " - " << b << " = ";
double Divide (double a, double b) //Dividing
cout << a << " / " << b << " = ";
stop = 1;
while(stop < 2)
cout << "C++ Assigment Two - Random Calculator" << endl;
cout << "\n";
srand(time(0)); //this will produce a new number after each execution.
num1 = 1+rand()%20;
num2 = 1+rand()%20;
cout << "Do you wish to: (1)Add, (2)Subtract, (3)Multiply or (4)Divide ?" << endl;
cin >> choice;
switch (choice) //Calculator Function
case 1: cout << num1 << "+" << num2;
ans = num1 + num2;
case 2: cout << num1 << "x" << num2;
ans = num1 x num2;
case 3: cout << num1 << "-" << num2;
ans = num1 - num2;
case 4: cout << num1 << "/" << num2;
ans = num1 / num2;
cin >> usans;
If (ans == usans)
cout<< "/nYour answer is correct"
cout << "/nIncorrect Answer"
cout <<"\n\nDo you wish to (E)xit or (R)estart";
cin >> ch;
//this if statment will keep looping untill they enter E or e...
if(ch == 'E' || ch == 'e') stop = 2;