Thank you for visiting Flesh out the body of the print seconds function so that it prints the total amount of seconds given the hours minutes and seconds as. This page is designed to guide you through key points and clear explanations related to the topic at hand. We aim to make your learning experience smooth, insightful, and informative. Dive in and discover the answers you're looking for!
Answer :
In this exercise, using the knowledge of computational language in C++, we have that this code will be written as:
The code is in the attached image.
We can write the C++ as:
#include
using namespace std;
void print_seconds(int hours, int mints, int seconds)
{
int total_seconds= hours*3600 + mints*60 + seconds;
cout<<"Total seconds are: "<
}
int main()
{
int h,m,s;
cout<<"enter hours if any or enter 0"<
cin>>h;
cout<<"enter mints if any or enter 0"<
cin>>m;
cout<<"enter seconds if any or enter 0"<
cin>>s;
print_seconds(h,m,s);
return 0;
}
See more about C++ at brainly.com/question/19705654
Thank you for reading the article Flesh out the body of the print seconds function so that it prints the total amount of seconds given the hours minutes and seconds as. We hope the information provided is useful and helps you understand this topic better. Feel free to explore more helpful content on our website!
- You are operating a recreational vessel less than 39 4 feet long on federally controlled waters Which of the following is a legal sound device
- Which step should a food worker complete to prevent cross contact when preparing and serving an allergen free meal A Clean and sanitize all surfaces
- For one month Siera calculated her hometown s average high temperature in degrees Fahrenheit She wants to convert that temperature from degrees Fahrenheit to degrees
Rewritten by : Jeany
Answer:
Step by step explanation along with code and output is provided below
Explanation:
#include
using namespace std;
// print_seconds function that takes three input arguments hours, mints, and seconds. There are 60*60=3600 seconds in one hour and 60 seconds in a minute. Total seconds will be addition of these three
void print_seconds(int hours, int mints, int seconds)
{
int total_seconds= hours*3600 + mints*60 + seconds;
cout<<"Total seconds are: "< } // test code // user inputs hours, minutes and seconds and can also leave any of them by entering 0 that will not effect the program. Then function print_seconds is called to calculate and print the total seconds. int main() { int h,m,s; cout<<"enter hours if any or enter 0"< cin>>h; cout<<"enter mints if any or enter 0"< cin>>m; cout<<"enter seconds if any or enter 0"< cin>>s; print_seconds(h,m,s); return 0; } Output: enter hours if any or enter 0 2 enter mints if any or enter 0 25 enter seconds if any or enter 0 10 Total seconds are: 8710