6. Write a function called convertTime, which accepts the number of seconds (integer) seconds and has three integer output parameters hr, min, sec. The function will convert the number of seconds into hours, minutes and seconds. (Hint: hr = seconds/3600, min= seconds%3600/60, sec=seconds%60) e.g. input of 7000 should produce the output values: 1, 56, 40. Write a program that asks a user to input a time period in seconds, calls the function convertTime to convert the time period into hours, minutes and seconds, and then prints the result in the format below: 7000 seconds = 1 hr 56 min 40 sec
Addition of Two Numbers
Adding two numbers in programming is essentially the same as adding two numbers in general arithmetic. A significant difference is that in programming, you need to pay attention to the data type of the variable that will hold the sum of two numbers.
C++
C++ is a general-purpose hybrid language, which supports both OOPs and procedural language designed and developed by Bjarne Stroustrup. It began in 1979 as “C with Classes” at Bell Labs and first appeared in the year 1985 as C++. It is the superset of C programming language, because it uses most of the C code syntax. Due to its hybrid functionality, it used to develop embedded systems, operating systems, web browser, GUI and video games.
By using the C++
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images