[C++] Problem using Dev C++

Discussion in 'Mixed Languages' started by Deb_Rider, Feb 27, 2012.

  1. Deb_Rider

    Deb_Rider MDL Senior Member

    Aug 21, 2010
    417
    66
    10
    #1 Deb_Rider, Feb 27, 2012
    Last edited by a moderator: Apr 20, 2017
    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
    [​IMG]
    please help me out.......
     
  2. zekecoma

    zekecoma MDL Novice

    Apr 6, 2011
    13
    1
    0
    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++. :wallbash::wallbash::wallbash:
     
  3. myluck1990

    myluck1990 MDL Novice

    Oct 15, 2009
    17
    6
    0
    Hi Deb

    It works fine with V C++ 2010

    Here is the result

    DebRider.jpg
     
  4. R29k

    R29k MDL GLaDOS

    Feb 13, 2011
    5,171
    4,811
    180
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Deb_Rider

    Deb_Rider MDL Senior Member

    Aug 21, 2010
    417
    66
    10


    :eek::eek::eek:
    I liked the software.......:(
    also had quite similar name as my own name......:p
    Ok I'm uninstalling today............:mellow::bye2::bye2:
    I'll install vs 2010............:mellow::sly: