I'm writing a program for my C++ class that receives input and displays the fraction input. I can't figure out for the life of me why it is not working. I've got a syntax error somewhere. Please help a brotha out.
Code:#include <iosotream>
using namespace std
void getFrac(int& , int&);
int main()
{
int num, // input - fraction numerator
denom; // input - fraction denominator
cout << "Enter a common fraction "
<< "as 2 integers seperated by a slash: ";
getFrac(num, denom);
cout << "Fraction is " << numerator
<< " / " << denomerator << endl;
system("pause");
return 0;
}
// Reads a fraction.
// Pre: none
// Post: Returns fraction numerator through numerator
// Returns fraction denominator through denominator
void getFrac(int& numerator, // OUT
int& denominator) // OUT
{
char slash; // temporary storage for slash
cin >> numerator >> slash >> denominator;
}