Answer to Question #233678 in C++ for Brie

Question #233678

Write a method that receives elapsed time in seconds as a parameter.The method should then display the elapsed time in hours , minutes and seconds.For example , If the elapsed time is 9630 seconds , then the method should display 2:40:30 . Write a main() method that will prompt a user for elapsed time of an event in seconds, And use received value to demonstrate that the method works correctly.


1
Expert's answer
2021-09-06T01:59:24-0400
#include <iostream>
using namespace std;
void Convert(int secs){
	
    int hr = 0;
    int mn = 0;
    int sec = 0;
 
  
    hr = secs/3600;
    secs = secs%3600;
    mn = secs/60;
    secs = secs%60;
    sec = secs;
 
   
    cout<<hr<<" : "<<mn<<" : "<<sec<<"\n";
}
//Testing code
int main(){
	
	Convert(9630);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS