Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Aim: To implement a program to convert time in 24 hour format to 12 hour format.
Code:
#include
class time24
{
public:
int hhhh;
void displaytime24()
cout<<"\nTime(24):"< } void gettime24() { cout<<"\nEnter time in 24 hour format:"; cin>>hhhh; } }; class time12 { public: int hh,mm; char ap[3]; time12(time24 t2) { if((t2.hhhh/100)>=12) { if(((t2.hhhh/100)%12)==0) { hh=12; } else { hh=(t2.hhhh-1200)/100; } strcpy(ap,"pm"); } else { hh=(t2.hhhh/100); strcpy(ap,"am"); } mm=(t2.hhhh%100); } void displaytime12() { cout<<"\nTime(12):"; if(hh<10) cout<<"0"; cout< if(mm<10) cout<<"0"; cout< } }; void main() { clrscr(); time24 t1; t1.gettime24(); time12 t2=t1; t1.displaytime24(); t2.displaytime12(); getch(); } Output: Enter time in 24 hour format:1830 Time(24):1830 hours Time(12):06:30 pm
}
void gettime24()
cout<<"\nEnter time in 24 hour format:";
cin>>hhhh;
};
class time12
int hh,mm;
char ap[3];
time12(time24 t2)
if((t2.hhhh/100)>=12)
if(((t2.hhhh/100)%12)==0)
hh=12;
else
hh=(t2.hhhh-1200)/100;
strcpy(ap,"pm");
hh=(t2.hhhh/100);
strcpy(ap,"am");
mm=(t2.hhhh%100);
void displaytime12()
cout<<"\nTime(12):";
if(hh<10)
cout<<"0";
cout< if(mm<10) cout<<"0"; cout< } }; void main() { clrscr(); time24 t1; t1.gettime24(); time12 t2=t1; t1.displaytime24(); t2.displaytime12(); getch(); } Output: Enter time in 24 hour format:1830 Time(24):1830 hours Time(12):06:30 pm
if(mm<10)
cout< } }; void main() { clrscr(); time24 t1; t1.gettime24(); time12 t2=t1; t1.displaytime24(); t2.displaytime12(); getch(); } Output: Enter time in 24 hour format:1830 Time(24):1830 hours Time(12):06:30 pm
void main()
clrscr();
time24 t1;
t1.gettime24();
time12 t2=t1;
t1.displaytime24();
t2.displaytime12();
getch();
Output:
Enter time in 24 hour format:1830
Time(24):1830 hours
Time(12):06:30 pm
write a program that counts the number of occurences of the string in the n-th Padovan string P(n) program in java // aakash , suraj , prem sasi kumar kamaraj college progr
A: The simplest instance of a smart pointer is auto_ptr that is included in the standard C++ library. Auto Pointer only takes care of Memory leak & does nothing regarding dangling
There are 25 employees in a business. Each employee has 5 sales each day of the month (Assume there are 30 days in each month of the year). Draw a flowchart for a pr
In this assignment, you will be modifying your Assign-05 code to use more inheritance. As well, in this assignment, you will be asked to use newand delete, throw and catch except
We are now quite happy to use the basic mathematical expressions, however in engineering we use scientific functions i.e Sin , Cos , ln etc . Within C we have the following functi
Is it possible to pass an entire structure to functions? Yes, it's possible to pass an entire structure to a function in a call by method style. Some programmers prefer to decl
(a) Write a procedure called (mult x y) that multiplies two numbers x and y in a recursive manner using successive addition. Specifically, note that a x b = a + a + .... + a (b tim
Deliverables: you are required to upload your c code in the assignment dropbox set in Moodle. You are supposed to work with Linux gcc compiler and pico editor for compiling via the
Should I explicitly call a destructor on a local variable? Explain it.
what is oops
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd