0% found this document useful (0 votes)
20 views

Exp3 4

This C++ program defines a date class with methods to accept time input in hours, minutes, and seconds, convert it to a 24-hour format with days, and display the results. The main function creates a date object, calls the accept method to get the time, and then calls display to output the converted time and day.

Uploaded by

sakharam_gawade
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Exp3 4

This C++ program defines a date class with methods to accept time input in hours, minutes, and seconds, convert it to a 24-hour format with days, and display the results. The main function creates a date object, calls the accept method to get the time, and then calls display to output the converted time and day.

Uploaded by

sakharam_gawade
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

EXP3_4 #include<iostream.h> #include<conio.

h> class date { public: int hr,min,sec,nhr,nmin,nsec,day; void accept() { cout<<"Hours:\t"; cin>>hr; cout<<"Minutes:\t"; cin>>min; cout<<"Seconds:\t"; cin>>sec; } void display() { nsec=sec; sec=sec/60; nsec=nsec%60; min=sec+min; nmin=min; min=min/60; nmin=nmin%60; hr=min+hr; nhr=hr; hr=hr/24; nhr=nhr%24; int day=0; day=day+hr; cout<<"\nHours:\t"<<nhr; cout<<"\nMinutes:\t"<<nmin; cout<<"\nSeconds:\t"<<nsec; cout<<"\nDay:\t"<<day; } }; void main() { clrscr(); date t; t.accept(); t.display(); getch(); }

Page 1

Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)

You might also like