Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program One Write a program, named time.cpp that converts time in 24-hour notation as two integers one for hours and one for minutes and converts
Program One Write a program, named time.cpp that converts time in 24-hour notation as two integers one for hours and one for minutes and converts it to 12-hour notation. Your program should implement 3 functions: one to get input from a data file, one to do the conversion, and one to do output the converted time Record the A.M./P.M. information as a char with the value'A' for AM or 'P' for PM. Pass the char as a call-by-reference formal parameter to the conversion function Your main function should open the data file and use a while loop to process the time stored in the file one by one. For each time, call the three user defined function to read, convert, and output the result. Navigate to your project directory under the codelite directory. Copy the data file into your project directory using the following Unix command cp cen/data/times.dat Here is an example of the data file 20:45 10:20 23:59 5:03 8:10 For this data file, the output from the program should be 8:45 PM 10:20 AMM 11:59 PM 5:03 AM 8:10 AM
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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