Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ function named time() that has an integer parameter named seconds and three integer reference parameters named hours, mins, and secs. The function

Write a C++ function named time() that has an integer parameter named seconds and three integer reference parameters named hours, mins, and secs. The function is to convert the passed number of seconds into an equivalent number of hours, minutes, and seconds. Using the reference parameters, the function should alter the arguments in the calling function.

** The solution is wrong in the textbook solutions section. ** Here is what I have done, just need some help debugging and tweaking:

image text in transcribed

10 include kiostream 11 I include kiomanip #include kcmath 12 using namespace std; 13 14 15 I void time (int, int&, int&, int&); 16 17 int main 18 int seconds, hours, minutes secs; 19 20 cout "Please enter the time in seconds to be converted 21 Cin secs; 22 23 time (seconds, &hours, &minutes, &secs); 24 cout "Hours hours endl 25 cout "Minutes minutes endl 26 cout Remaining Seconds secs endl; 27 28 system ("pause"); 29 30 31 return 0 32 33 34 35 void time (int secnds, int hours int &m int &secs) inutes 36 int total 37 38 total secnds 3600 Original Seconds Total 39 hours secnds 3600 Equivalent Hours Calculation minutes total 60 Equivalent Minutes Calculation 41 secs total 60) Equivalent Seconds Calculation 42 43 44 45

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions