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
The following pseudocode is an example of ____.do stepAdo stepBif conditionC is true thendo stepDelsedo stepEendifwhile conditio
rewona [7]

Answer:

Option d pretest

Explanation:

Given the pseudocode:

  1. do stepA
  2. do stepB
  3. if conditionC is true
  4. then do stepD
  5. else
  6. do stepE
  7. end if
  8. while conditionF is true
  9. do stepG
  10. end while

The pseudocode above shows that there is a pretest before some codes are executed. For example, line 3 check if condition is true then only execute stepD otherwise execute stepE. Line 8 check if conditionF is true then repeatedly execute stepG. These are examples of pretest a condition will must be met (pretest passed) before a block of codes can be executed. This pretest can be seen in if-else statements and also the while condition.  

6 0
2 years ago
Gary lives in an area that receives high rainfall throughout the year. Which device would be useful to him to maintain his compu
-BARSIC- [3]

The correct answer is B.UPS

A UPS or Uninterruptable Power supply makes sure that you have backup in case there is a power outage in your area. It provides ample time for you to save all files before shut down.

6 0
3 years ago
Read 2 more answers
On "assignments" what does XMPT mean?
tresset_1 [31]

Exempt is what it means


3 0
2 years ago
Which ics function records time accounting and procures needed items?
vladimir1956 [14]
It is the finance / administration function that records time accounting and procures the needed items
7 0
2 years ago
Ethernet ensures that _____ on a shared network never interfere with each other and become unreadable.
Dmitry [639]

Answer:

Signals.

Explanation:

Encryption is a form of cryptography and typically involves the process of converting or encoding informations in plaintext into a code, known as a ciphertext. Once, an information or data has been encrypted it can only be accessed and deciphered by an authorized user.

Some examples of encryption algorithms are 3DES, AES, RC4, RC5, and RSA.

Ethernet ensures that signals on a shared network never interfere with each other and become unreadable through the use of encapsulation and standard encryption protocols.

In Computer Networking, encapsulation can be defined as the process of adding a header to a data unit received by a lower layer protocol from a higher layer protocol during data transmission. This ultimately implies that, the header (segment) of a higher layer protocol such as an application layer, is the data of a lower layer such as a transportation layer in the Transmission Control Protocol and Internet Protocol (TCP/IP).

The TCP/IP model comprises of four (4) layers;

1. Application layer: this is the fourth layer of the TCP/IP model. Here, the data unit is encapsulated into segments and sent to the transport layer.

2. Transport layer (layer 3): it receives the segment and encapsulates it into packets and sends to the internet layer.

3. Internet layer (layer 2): packets are encapsulated into frames.

4. Network layer (layer 1): frames are then converted into bits and sent across the network (LAN).

Hence, the data unit encapsulated inside a packet is known as segment, which is typically referred to as packet segmentation.

Additionally, these data, segments, packets, frames and bits transmitted across various layers are known as protocol data units (PDUs).

8 0
2 years ago
Other questions:
  • Your customer, Mykel, is ordering a custom-built computer for his home office and isn’t sure which components should be the high
    12·1 answer
  • My question is do you learn how to do a voice over in technology?
    14·1 answer
  • Write a method named removeDuplicates that accepts a string parameter and returns a new string with all consecutive occurrences
    7·1 answer
  • Choose all stages of the information processing cycle.
    12·2 answers
  • Cottonisagoodreflectorofsound​
    6·2 answers
  • What is a best practice when approaching an automation effort?
    6·1 answer
  • Because Brainly is such a big organization for students in need of help with their school work, I believe that it was either som
    15·1 answer
  • Aii so is anyone pushing P?<br> if u are u a g
    8·2 answers
  • What actions might contribute to recommendations you see online?
    9·1 answer
  • If I use the command right(90), which way will Tracy turn?<br> If correct I mark brainlist
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!