SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Walter Savitch ,julia Lobur
Chapter:
Strings And Vectors
Exercise:
Programming Projects
Question:13 | ISBN:9780321531346 | Edition: 7

Question

Write a program 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.

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Sorry the answer is not available at the moment…

If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.

Spread the 'tradition of sharing'.