1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ilia_Sergeevich [38]
2 years ago
6

In function main prompt the user for a time in seconds. Call a user defined function to calculate the equivalent time in hours,

minutes, and seconds. Parameters should be the time in total seconds and pointers to the hours, minutes, and seconds. Print the equivalent in hours, minutes, and seconds in function main. Test with a value of 36884 seconds Output should look something like this: 5000 seconds can be broken into 1 hour 23 minutes and 20 seconds"

Computers and Technology
1 answer:
Molodets [167]2 years ago
4 0

Answer:

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

   cout<<"Enter time in seconds:";

   int time, hour, minutes, seconds,initialTime;

   

   cin>>time;

   initialTime = time;

   

   hour = floor(time / 3600);

   time = time % 3600;

   minutes = floor(time / 60);

   time = time % 60;

   seconds = time;

   cout<< initialTime<<" can be broken down into: "<<endl;

   cout<<hour << " hour(s)"<<endl;

   cout<<minutes <<" minutes"<<endl;

   cout<<seconds <<" seconds"<<endl;

   return 0;

}

Explanation:

The programming language use is c++

The module cmath was called to allow me perform some math operations like floor division, and the Iostream allows me to print output to the screen. Using namespace std allows me to use classes from the function std.

I prompt the user to enter time in second, then declare all the variables that will be used which include time, hour, minutes, seconds and initialTime.

initialTime is used to hold the the time input entered by the user and will be printed at the end no arithmetic operation is carried out on it.

Floor division (returns the quotient in a division operation) and Modulo (returns the remainder in a division operation) division is used to evaluate the hours, the minutes and the seconds.

The final answers are then printed to the screen.

I have uploaded the c++ file and a picture of the code in action

You might be interested in
Joe is a part of a team where the members come from various cultures and have different perspectives and viewpoints. What does J
Mamont248 [21]

Answer:

various cultures of the world.

Explanation:

You need to understand the cultures of the world, to work in a multinational company. Undoubtedly, you need to understand that the employees working in multinational companies are from various cultures, and they think differently as well. You need to understand them, and only then you can make them your friend and finally work together with full cooperation to ensure the best work. And for your success as well as the success of the company this is important.

6 0
2 years ago
Josie, your best friend, is having a huge Sweet Sixteen party. She has designated you to address all 100 of the envelopes (using
marysya [2.9K]

You add all the addresses into excel and and do mail-merge with the invitation. Adding the 100 addresses is probably a lengthy process but once this is complete you can just add on addresses and once a year or whenever you have to mail something to everyone, it's  a only mouse-click.

4 0
3 years ago
Quick!!! Brainliest
xxTIMURxx [149]
D. A technology-and creativity-driven world
7 0
3 years ago
What is the primary responsibility of the physical layer in data communication?
melamori03 [73]
 It is responsible for transmitting these bits as signals over a wire, optical fiber, wireless, or other <span>medium.</span>
3 0
3 years ago
How can you modify elements of the Start menu?
VladimirAG [237]

Answer:

C

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • The _______ displays the name of the open file and the program.
    13·1 answer
  • you were discussing software privacy with a friend were surprised to learn how software privacy can impact your life everyday. w
    10·1 answer
  • How can I use the internet/social media to protect my identity?
    14·1 answer
  • Methods used to change variables are called ______. equals accessors toString void mutators
    5·1 answer
  • Write any two use of computer in school​
    15·1 answer
  • Generate an array x that has n=100 random numbers that are uniformly distributed over the interval [0,1) . Look up how to use th
    8·1 answer
  • 9. What is composition? Why is composition important?
    11·1 answer
  • A form’s height is ______________________.<br><br> A property<br><br> A method<br><br> An event
    10·1 answer
  • Don is visiting digital stores and searching the internet to learn about high-definition DVD players before he buys one. This is
    8·1 answer
  • Which of these is system software? Check all
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!