Question
C++ Implement a program to convert hours from 24 hours format to AM/PM format, as follows: Ask the user to enter the time. e.g. for
C++ Implement a program to convert hours from 24 hours format to AM/PM format, as follows:
Ask the user to enter the time. e.g. for 14:45, the hour (14) and the minute (45) are entered by user separately as integers.
Make the conversion to PM format.
Write the result output that will print the time properly formatted saying some greetings according to the current time. e.g. 2:45 PM Good Afternoon!
Implement the code using at least 3 functions: input; convert; and output;
From the main function, after create the method named convertTimeAPI, call the convertTimeAPI function; the function convertTimeAPI is used as the method/function that is the starting point that calls all other functions.
The given starting code to work from:
/* * 24-hour to 12-hour time converter * May crash or produce unreasonable results if provided invalid input */
#include
bool done = false; char consoleInput;
cout << "Enter only the hour without minutes in 24-hour format" << endl; cin >> hour; cout << "Please enter the minutes" << endl; cin >> minute; } //Converts 24-hour time to 12-hour time //to do
//Prints the time in 12-hour format //to do
// main function int main(void) {
input();
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started