I'm currently working on a school project in which I have to create a class for this client program. I commented out all the code I'm not currently using to test each bit by bit as I create the class bit by bit. When I compile and run the program, the cout statements don't output to the screen. All that appears is "Press any Key to continue..." Any help would be appreciated.
This has never happened until today so I'm stumped as to what the problem could be.
Update: When I run any other previous CPP I have it runs just fine, it's only this file that seems to have trouble showing any output.
#include <iostream>
#include "fraction.h"
usingnamespace std;
int main()
{
fraction f1(9,8); //calling a parameterized class constructor
fraction f2(2,3); //calling a parameterized class constructor
fraction result; //calling a default class constructor
fraction f3; //calling a default class constructor
cout << "The result starts off at ";
result.print(); //calling an observer function
cout << endl;
/*cout << "The product of ";
f1.print();
cout << " and ";
f2.print();
cout << " is ";
result = f1.MultipliedBy(f2); //a class binary operation - function
result.print();
cout << endl;
f3 = result; //assignment
if (f2.isGreaterThan(f3)){ //a class relational expression - boolean operation/function
f2.print();
cout <<" is greater than ";
f3.print();
cout<<endl;
} else {
f2.print();
cout <<" is less than ";
f3.print();
cout<<endl;
}
cout << "The sum of ";
f1.print();
cout << " and ";
f2.print();
cout << " is ";
result = f1.AddedTo(f2); //a class binary operation - function
result.print();
cout << endl;
cout << "The difference of ";
f1.print();
cout << " and ";
f2.print();
cout << " is ";
result = f1.Subtract(f2); //a class binary operation - function
result.print();
cout << endl;
if (f1.isEqualTo(f2)){ //a class relational expression - boolean operation/function
cout << "The two fractions are equal." << endl;
} else {
cout << "The two fractions are not equal." << endl;
}
const fraction f4(12, 8);
const fraction f5(202, 303);
result = f4.DividedBy(f5); //a class binary operation - function
cout << "The quotient of ";
f4.print();
cout << " and ";
f5.print();
cout << " is ";
result.print();
cout << endl; */
system ("PAUSE");//exclude statement if not using Dev-C++
return 0;
}
How would I check for that? I dont think I have, I opened a new blank project file in Dev-C++ and went from there.
I'm not familiar with Dev-C++ - (it may not even have that option, AFAIK) but it'll be in either the project settings or the environment settings somewhere.
You could try running it outside of Dev-C++, see whether you get output then.