ok folks check this out I actually got my first program with objects to run buuut it keeps giving me this funky output check out the code
Code:
#include <iostream.h>
#include <iomanip.h>
//class declaration
class Time
{
private:
int hrs;
int mins;
int secs;
public:
Time(int=12.0, int=00, int=00); //constructor function with defaults
void settime(int, int, int); //member function to copy a date
void showtime(void);
};
//implementation section
Time::Time(int hours, int minutes , int seconds)
{
hours=hrs;
minutes=mins;
secs=seconds;
}
void Time::settime(int hours, int minutes , int seconds)
{
hours=hrs;
minutes=mins;
secs=seconds;
return;
}
void Time::showtime(void)
{
cout<<"The time is";
cout<< setfill('0')
<<setw(2) << hrs << ":"
<<setw(2) << mins << ":"
<<setw(2) << secs ;
cout<<endl;
return;
}
int main()
{
Time a, b, c(13, 4, 0);
b.settime(12,25,2);
cout<<endl;
a.showtime();
b.showtime();
c.showtime();
cout<<endl;
return 0;
}
anyways here is the output
The time is-858993460:-858993460:00
The time is-858993460:-858993460:02
The time is-858993460:-858993460:00
Press any key to continue
anyone got any ideas where I went wrong