Question: How do I get this code to pass using these intructions: / / / / #include #include #include apex _ code.h #include using namespace

How do I get this code to pass using these intructions: //
//
#include
#include
#include "apex_code.h"
#include
using namespace std;
void minutes_to_12hour_time(stringstream &cin, stringstream &cout){
int minutes;
cin >> minutes;
int hours = minutes /60;
int minutes_remainder = minutes %60;
hours %=12;
cout hours ":" minutes_remainder "!" endl;
// Place code for translating minutes to 12 hour time
// Pretend this is your main function and you can use cin/cout
// as you would in main.
// If you want to print to the console for debugging use std::cout.
// Use cout for your final solution.
// First you want to get user input with cin
// Do any needed calculations
// Create output with cout
}
void numbers_to_12hour_time(stringstream& cin, stringstream& cout)
{
int hours =0;
int minutes =0;
int seconds =0;
char colonSign;
// Pretend this is your main function and you can use cin/cout
//reading input
cin >> hours >> colonSign >> minutes >> colonSign >> seconds;
hours += minutes /60.0;
minutes %=60;
hours += seconds /3600.0;
seconds %=60;
hours %=12;
//keep hours within 0 to 11 for 12 hour time
hours = hours %12;
//output hours, minutesm seconds
// Use cout for your final solution.
cout hours ":" minutes "." seconds "!" endl;
in this lab we will be coding two blocks of code (in apex_code.cpp), both translating time into a 12 hour clock. For our 12 hour clock, 12 o'clock will actually be 0
o'clock. So our hours range from 0 to 11, unlike an actual clock that have hours in the range 1 to 12.
This block of code gets a number of minutes from the user and translates that into time on a 12 hours clock. If the user puts 0 minutes into the program the
program should output the string "0:0!". The number before the colon is the number of hours, the number after the colon is the number of minutes. Here are some
more examples of input and output:
Input: "60"--> Output: ''
Input: "121"--> Output: '"
Input: "785"--> Output: "1:5!"// Notice the 12 hour clock time adjusts 13 hours to 1 hour.
HINT: There is a C++ operator that makes it easy to keep the hours between 0 and 11.
This block of code expands upon the first one. This time we will take the hours minutes and seconds from the user and translate to 12 hour clock time. The input
from the user is in the form "
 How do I get this code to pass using these intructions:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!