1

This program is intended to determine if a fractions is valid (non-zero, non-negative denominator) and to convert an improper fraction into a whole/mixed number. While running the program I get the message "Floating point exception" after it reads the inputs just inside the for loop.

Any insight into what is going on and how to fix it will be greatly appreciated.

```
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int num, numer, denom; // number of fractions, numerator, denominator
char slash; // storage for '/' symbol.
cin >> num;
cout << "num= " << num << endl;
for (int i=0; i<num; i++)
{
cin >> numer;
cin >> slash;
cin >> denom;
cout << "numer= " << numer << endl;
cout << "slash= " << slash << endl;
cout << "denom= " << denom << endl;
////////////////////////////////////
// ERROR HAPPENS AFTER THIS POINT //
////////////////////////////////////
cout << numer;
cout << slash;
cout << denom;
if (denom = 0)
cout << " ==> is invalid because denominator is zero";
if (denom < 0)
{
numer = numer * -1;
denom = abs(denom);
}
if (denom > 0)
cout << " ==> " << numer << "/" << denom;
if (numer/denom > 0)
cout << " ==> " << numer/denom << " " << abs(numer%denom) << "/"<< denom;
cout << endl;
cin >> numer >> slash >> denom;
}
return 0;
}
```