I've created a class Fraction and am trying to use it in a main () but keep getting an error in my compiler that says "main must return int". My teacher says it's fine but i need to compile and run so i know that it works. Any suggestions? Thank you, jennie
#include <iostream.h>
class Fraction
{
public:
int num, den;
};
void main()
{
Fraction oneFraction;
float decimal = oneFraction.num/oneFraction.den;
cout <<"Please enter a numerator "<<endl;
cin >>oneFraction.num;
cout <<"The numerator is "<<oneFraction.num<<endl;
cout <<"Please enter a denominator "<<endl;
cin >>oneFraction.den;
while (oneFraction.den == 0)
{
cout<<"Enter a number greater than zero."<<endl;
cin >>oneFraction.den;
}
cout <<"The denominator is "<<oneFraction.den<<endl;
cout <<"The fraction in decimal value is "<<decimal<<endl;
if(decimal>1)
cout<<"The decimal value is greater than one."<<endl;
getchar();
}