Hello,
Anyone here experience with Dev c++ ? Just installed version 4.9.9.2 with Windows XP operating system service pack 3 . I installed it in the C drive. It seems that the program is compling without any error but not running. A windows just came for a second and then disappeared and i wont be able to see my results. Any solution for that? I tried to run this program and MS visual studio it runs well.
regards-
lemon
Code:#include <iostream>
using namespace std;
class Ratio
{ public:
void assign(int, int);
double convert();
void invert();
void print();
private:
int num, den;
};
int main()
{ Ratio x;
x.assign(22,7);
cout << "x = ";
x.print();
cout << " = " << x.convert() << endl;
x.invert();
cout << "1/x = "; x.print();
cout << endl;
}
void Ratio::assign(int numerator, int denominator)
{ num = numerator;
den = denominator;
}
double Ratio::convert()
{ return double(num)/den;
}
void Ratio::invert()
{ int temp = num;
num = den;
den = temp;
}
void Ratio::print()
{ cout << num << '/' << den;
}