Code: #include<iostream.h> #include<conio.h> using namespace std; class time { private: int hr; int min; public: time(); time(int,int); void show() const; time operator+(time &); }; time::time() { hr=min=0; } time::time(int hr1,int min1) { hr=hr1; min=min1; } void time::show() const { cout<<"\nHour="<<hr; cout<<"\nMinute="<<min; } time time::operator+(time &t) { time tmp; tmp.min=(min+t.min)%60; tmp.hr=hr+t.hr+(min+t.min)/60; return tmp; } int main() { time t1(2,30); time t2(3,56); t1.show(); t2.show(); time t3; t3=t1+t2; t3.show(); getch(); } Run through the program, it's a simple program of using a class object. It's fine running in Turbo C++.. but it's not working in dev c++...Showing these errors please help me out.......
Stop using Dev-C++. It is outdated. Any book, or class that still requires you to use it, let alone headers in C++ with iostream.h are teaching you how to code wrong and are just WRONG. The C++ in Dev-C++ was created before it was even standardised. Go use Visual Studio 2010 Express, if you want to learn C++. Why do people still use Dev-C++.
I liked the software....... also had quite similar name as my own name...... Ok I'm uninstalling today............ I'll install vs 2010............