0

/* When I run this code the random numbers that are supposed to be generated will not cout. Any suggestions would be a great help!*/

```
int main()
{
Fraction operand1, operand2, resultant;
int a, b, c, n, d;
char op, choice;
//char opchar:
srand(time(0));
system("cls");
//a.setAll(1); //1 indicates that it's the 1st fraction
//b.setAll(2); //2 indicates that it's the 2nd fraction
cout << "Enter a menu selection (1 - 4)\n"<<"1 - Addition\n"<<"2 - Subtrtaction\n"<<"3 - Multiplication\n"<<"4 - Division\n"<<endl;
cin >> choice;
switch (choice)
{
case 1:
op = FRAC_ADD;
break;
case 2:
op = FRAC_SUB;
break;
case 3:
op = FRAC_MUL;
break;
case 4:
op = FRAC_DIV;
break;
//default: //if operator is illegal shut program down
cout << "Invalid operator." <<endl;
return (0);
}
/*if ((a.den == 0) || (b.den == 0)) //fraction undefined if so
cout << "\n\nFraction is undefined.";
else //else fraction can be worked with
{
c = Fraction_Do_Op(op, a, b);
cout << "\n\n";
c.reduce(); //reduce to simplify fraction
c. DisplayMixed();
}*/
do{
n = 1 + (rand() % 11);
d = 2 + (rand() % 11);
operand1.setNum(n);
operand1.setDen(d);
n = 1 + (rand() % 11);
d = 2 + (rand() % 11);
operand2.setNum(n);
operand2.setDen(d);
n = operand1.getNum() * operand2.getNum();
d = operand1.getDen() * operand2.getDen();
resultant.setNum(n);
resultant.setDen(d);
resultant.reduce();
do
{
cout <<"\n\nWhat is ";
//operand1.print();
cout << " / ";
//operand2.print();
cout << "?";
cout<<"\n\n(Enter numerator / denominator)YOUR ANSWER MUST BE IN REDUCED FORM ->";
cin >> n >> op >> d;
}while(n != resultant.getNum() || d != resultant.getDen());
cout <<"\nCORRECT!!! Enter q to quit, Enter c to continue ->";
cin >> choice;
}
while(choice != 'q');
return 0;
}
```