Please help me find what is wrong with this code. I mean seriously I have combed through it more than a few times. I need to know why it is not delivering me the correct message and why my numbers are so tight. they have almost no variation at all. Math and pointer location I believe.. I'm no expert. help would be appreciated.
#include <iostream>
#include <stdio.h>
#include <ctype.h>
#include<time.h>
#include<math.h>
usingnamespace std;
void Outstatment(int);
int MathOp_A(int);
int MathOp_B(int);
int MathOp_C(int);
int MathOp_D(int);
int main()
{
int op;
int level;
char play ;
cout<< "Do you wanna play the game " <<endl;
cin >> play;
play=tolower(play);
do{
if (play= 'y')
{
cout << "Welcome to the math tutor !" << endl;
cout << "Which math operation would you like to train?" << endl;
cout << "=( Enter 1 for Addition -=\n" << endl;
cout << "=( Enter 2 for Subtaction-=\n" << endl;
cout << "=( Enter 3 for Multiplication-=\n" << endl;
cout << "=( Enter 4 for Divsion-=\n" << endl;
cin >> op;
cout << "At what game level do you wish to train at?" << endl;
cout << "=( Enter 1 for 1 digits-=\n" << endl;
cout << "=( Enter 2 for two-=\n" << endl;
cout << "=( Enter 3 for three-=\n" << endl;
cout << "=(feel free to test the programs limits!" << endl;
cin >> level;
switch (op)
{
case 1:
Outstatment(MathOp_A (level));
break;
case 2:
Outstatment(MathOp_B (level));
break;
case 3:
Outstatment( MathOp_C (level));
break;
case 4:
Outstatment( MathOp_D (level));
break;
default : cout<<"??"<<endl;
}
cout<< "Do you wanna play again? " <<endl;
cin >> play;
}
else( play != 'y')
{
cout<<"have a good day!"<<endl;
cout<< "okay bye."<<endl;
}
} while( play);
system("pause");
return 0;
}
int MathOp_C ( int b )
{
int wiz;
int x,y;
int guess;
int pass;
wiz= (x*y);
srand((unsigned)time(0));
x=rand()%(10^(b-1));
y= rand()%(10^(b-1));
cout<< "--------Multiplication-------\n\n"<<endl;
cout<<endl;
cout<<endl;
cout<< x <<" X "<< y<< " = \n Enter Answer"<<endl;
cin>> guess;
if (guess= wiz)
pass =1;
if (guess != wiz)
pass=2;
return (pass);
}
int MathOp_B ( int w )
{
int wiz;
int x,y;
int guess;
int pass;
int s,t;
wiz=(s-t);
srand((unsigned)time(0));
x,y= rand()%(10^(w-1));
s=x;
t=y;
if ( x < y )
{
s=y;
w=x;}
cout<< "--------Subtraction-------\n\n"<<endl;
cout<< s <<" - "<< t<<" = \n Enter Answer"<<endl;
cin>> guess;
if (guess= wiz)
pass =1;
if (guess != wiz)
pass=2;
return (pass);
}
int MathOp_A ( int q )
{
int wiz;
int x,y;
int guess;
int pass;
wiz=(x+y);
srand((unsigned)time(0));
x,y= rand()%(10^(q-1));
cout<< "--------Addition-------\n\n"<<endl;
cout<< x <<" + "<< y<< " = \n Enter Answer"<<endl;
cin>>guess;
if (guess= wiz)
pass =1;
if (guess != wiz)
pass=2;
return (pass);
}
int MathOp_D ( int h )
{
int wiz;
int x,y;
int guess;
int pass;
wiz = (x/y);
srand((unsigned)time(0));
x,y= rand()%(10^(h-1));
cout<< "--------Division-------\n\n"<<endl;
cout<< x <<" / "<<y<< " = \n Enter Answer"<<endl;
cin>> guess;
if (guess= wiz)
pass =1;
if (guess != wiz)
pass=2;
return (pass);
}
void Outstatment ( int j)
{
int ran;
srand((unsigned)time(0));
ran= rand()%4;
switch (j)
{
case 1:
{
switch (ran)
{
case 1: cout <<" way to go!!! "<<endl;
break;
case 2: cout <<" You sure knocked that one outta there! "<<endl;
break;
case 3: cout << " Whoa!!! Wait.. Who the heck ARE you again? "<< endl;
break;
case 4: cout << " Your Not too bad at all.. "<<endl;
break;
default: cout<< " why am I seeing this?"<<endl;
}
} break;
case 2:
{
switch (ran)
{
case 1: cout <<" So Close!! :).. "<<endl;
break;
case 2: cout <<" Incorrect "<<endl;
break;
case 3: cout << " Think about it. "<< endl;
break;
case 4: cout << " At first, if you do not succeed.. "<<endl;
break;
default: cout<< " why am I seeing this?"<<endl;
}
}
break;
default: cout<< " what it this ?" <<endl;
}
}
Unless you know what you are doing, the `^` operator has a different meaning in c++ (and most programming languages I know of). This operator is called the bitwise exclusive and it operates on bits