0

Hey guys, this is a calculator program.

I keep getting 0s for my answers... is there something wrong with the logic in this function:

```
main()
cin >> choice;
while ( choice != 'q' && choice != 'Q' ) {
cout << "For first fraction\n";
getFract(choice, 1, num1, den1);
cout << "For second fraction\n";
getFract(choice, 2, num2, den2);
```

function

```
void getFract(char op, int fractNo, int & num, int & den)
{
cout << " Enter the numerator: ";
cin >> num;
if ( op == '/' && fractNo == 2 && num == 0 ) {
cout << "\nTo divide, the second fraction must be nonzero\n";
while ( num == 0 ) {
cout << "\nEnter a nonzero number for the numerator: ";
cin >> num;
} // endwhile
} // endif
cout << " Enter the denominator: ";
cin >> den;
if ( den = 0 ) {
cout << "The denominator must be nonzero\n";
while ( den = 0 ) {
cout << "\nEnter the denominator: ";
cin >> den;
} // endwhile
} // endif
}
```

*Edited 3 Years Ago by pyTony*: fixed formating