Question: #include #include #include / / For setw and setfill using namespace std; / / Function to convert 2 4 - hour format to 1 2
#include
#include
#include For setw and setfill
using namespace std;
Function to convert hour format to hour format
void cHourint hour int minute, int &hour string &period
if hour
hour;
period AM;
else if hour
hour;
period PM;
else if hour
hour hour;
period PM;
else
hour hour;
period AM;
int mainstring
int hour minute;
int houranswer,yY;
char colon;
string period;
cout "Military Time Converter to Standard Time" hour colon minute;
Validate Input
cHourhour minute, hour period;
do
if hour && hourcout hour colon minute && hour
cout hour colon minute minute minute
cout is not valid time" endl;
else
;
cout "Would you like to convert time? yn endl;
cin answer;
Convert to hour format
while answer y answer Y;
Display the time in hour format
return ;
my code above is giving me this output. MilitaryTimeConvertertoStandardTime
InputMilitaryTimehhmm:
::PM
Wouldyouliketoconverttimeyn
what do i need to change to recieve
Expected Output
MilitaryTimeConvertertoStandardTime
InputMilitaryTimehh:mm
::PM
Wouldyouliketoconvertanothertimeyn
::AM
Wouldyouliketoconvertanothertimeyn
::PM
Wouldyouliketoconvertanothertimeyn
:isnotavalidtime
Wouldyouliketoconvertanothertimeyn
:isnotavalidtime
Wouldyouliketoconvertanothertimeyn
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
