C++ program to display hours minutes and seconds in both 12 and 24 hours format:
24 Hours format : 23:30:12
Standard format : 11:30:12 pm
C++ CODE using Turbo C++ IDE.
code-
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int hours,mins,seconds,x;
cout<<"Enter hours=";
cin>>hours;
cout<<"\nEnter minutes=";
cin>>mins;
cout<<"\nEnter seconds=";
cin>>seconds;
if(hours > 24)
{
cout<<"Invalid Entery";
}
else
{
cout<<"\n24 Hours Format\n";
cout<<"Hours : Mins : Seconds\n"<<" "<<hours<<" : "<<mins<<" : "<<seconds<<"\n";
if(hours > 12)
{
hours=hours-12;
cout<<"12 Hours Format\n";
cout<<"Hours : Mins : Seconds\n"<<" "<<hours<<" : "<<mins<<" : "<<seconds;
}
else
{
cout<<"12 Hours Format\n";
cout<<"Hours : Mins : Seconds\n"<<" "<<hours<<": "<<mins<<" : "<<seconds;
}
}
} // end of main
24 Hours format : 23:30:12
Standard format : 11:30:12 pm
C++ CODE using Turbo C++ IDE.
code-
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int hours,mins,seconds,x;
cout<<"Enter hours=";
cin>>hours;
cout<<"\nEnter minutes=";
cin>>mins;
cout<<"\nEnter seconds=";
cin>>seconds;
if(hours > 24)
{
cout<<"Invalid Entery";
}
else
{
cout<<"\n24 Hours Format\n";
cout<<"Hours : Mins : Seconds\n"<<" "<<hours<<" : "<<mins<<" : "<<seconds<<"\n";
if(hours > 12)
{
hours=hours-12;
cout<<"12 Hours Format\n";
cout<<"Hours : Mins : Seconds\n"<<" "<<hours<<" : "<<mins<<" : "<<seconds;
}
else
{
cout<<"12 Hours Format\n";
cout<<"Hours : Mins : Seconds\n"<<" "<<hours<<": "<<mins<<" : "<<seconds;
}
}
} // end of main
// Improved it a little logically, pardon the indentation and styling.
ReplyDelete#include
#include
using namespace std;
int main()
{
int hours,mins,seconds,x;
cin>>hours;
cin>>mins;
cin>>seconds;
if(hours >= 24 || mins >= 60 || seconds >= 60)
{
cout<<"Invalid Time";
}
else
{
cout<<"24 Hours Format\n";
cout< 12)
{
hours=hours-12;
cout<<"12 Hours Format\n";
if (hours < 10) {cout<<"0"<<hours<<":"<<mins<<":"<<seconds<<" pm";}
else {cout<<hours<<":"<<mins<<":"<<seconds<<" pm";}
}
else
{
cout<<"12 Hours Format\n";
cout<<hours<<":"<<mins<<":"<<seconds<<" am";
}
}
return 0;
}
Write A C++ Program Take Hours, Minutes, Seconds And Print It In 24 Hours And Standard Format ~ Computer Science Magazine >>>>> Download Now
Delete>>>>> Download Full
Write A C++ Program Take Hours, Minutes, Seconds And Print It In 24 Hours And Standard Format ~ Computer Science Magazine >>>>> Download LINK
>>>>> Download Now
Write A C++ Program Take Hours, Minutes, Seconds And Print It In 24 Hours And Standard Format ~ Computer Science Magazine >>>>> Download Full
>>>>> Download LINK Je
We have been done so in our physics numerical but I dint know that the program has also established in order to perform the same function.
ReplyDeleteIF YOU NEED NEUMERICAL PROGRAMME PLEASE CONTACT ME.
DeleteApkproindir
ReplyDeleteTrickyworlds
Famoushindipoems
Write A C++ Program Take Hours, Minutes, Seconds And Print It In 24 Hours And Standard Format ~ Computer Science Magazine >>>>> Download Now
ReplyDelete>>>>> Download Full
Write A C++ Program Take Hours, Minutes, Seconds And Print It In 24 Hours And Standard Format ~ Computer Science Magazine >>>>> Download LINK
>>>>> Download Now
Write A C++ Program Take Hours, Minutes, Seconds And Print It In 24 Hours And Standard Format ~ Computer Science Magazine >>>>> Download Full
>>>>> Download LINK