Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program in Microsoft Visual Studio C++ that inputs a time from the conso

ID: 3696709 • Letter: W

Question

Write a program in Microsoft Visual Studio C++ that inputs a time from the console.
The time should be in the format"HH:MM AM" or "HH:MM PM".
Hours may be one or two digits,for example,"1:10 AM" or
"11:30 PM". Your program should include a function that
takes a string parameter containing the time. This function
should convert the time into a four-digit military time
based on a 24-hour clock. For example,"1:10 AM" would
output "0110 hours", "11:30 PM" would output "2330 hours",
and "12:15 AM" would output "0015 hours". The function may
either write the time to the console or return a string
to be written to the console by the main function. Use to_string and stoi

Explanation / Answer

Using System;

Using System.Collection.generic;

Using system linq;

Using system.text;

Namespace timedemo

Class program

Static void main (string() args)

Time t1;

t1=convert.totime ("6:23 pm");

Time t2=time.now;

Console.writeline ("hh:"+t2.hours);

Console.writeline ("mi:"+t2.minute);

Console.writeline ("sec:"+t2.second);

Console.writine ("ms:"+t2.millisecond);

Console.writeline ("/nshort time formate:"+t2.toshorttimestring ());

Console.writeline ("/nlong time formate:"+t2.tolongtimestring ());

Console.read ();

Close brace 3 time as per required, and I given smal leters to some alphabets check it and execute.I wrote the program using syntaxes.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote