I've created a class Fraction, and declared a private static character to hold the slash for displaying the fraction in fraction form later on. I can't seem to get the static char to compile and I need to figure out what I've done wrong, thank you for the help, jennie
cout<<"Enter the number 1 to see fraction in fraction format or "<<endl;
cout<<"the number 2 to see it in decimal form"<<endl;
cin>>input;
cin.ignore(80,'\n');
while (input != 1 && input !=2)
{
cout<<"Your entry must be a 1 or a 2, please try again."<<endl;
cin>>input;
cin.ignore(80,'\n');
}
if (input == 1)
cout<<"The fraction in traditional form is "<<num <<slash<<den<<endl;
if (input == 2)
cout<<"The fraction in decimal form is " <<decimal<<endl;
}
//main function to be named testfraction.cpp
#include <iostream.h>
#include "fraction.h"
#include "fraction.cpp"
int main()
{
Fraction oneFraction;
oneFraction.enterFractionValue();
oneFraction.displayFraction();
cout << "Press Enter to continue";
getchar();
return 0;
}
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.