Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a C++ program with a source file named ConvSecs.cpp that asks the user to enter a number of seconds and converts the seconds to days,

a C++ program with a source file named ConvSecs.cpp that asks the user to enter a number of seconds and converts the seconds to days, hours, minutes and remaining seconds. Your program will make use of long long int variables for all calculations. Note: the use of long long int requires that you have C++11 support. You should have this automatically if you are using a newer version of Visual Studio. The support is there for GCC as well, but you may need the -std=c++11 or -std=c++0x compiler flag.

For example, assuming the user enters 90061 for the seconds the output should be:

Day(s): 1 Hour(s): 1 Minute(s): 1 Remaining Second(s): 1 

Your program should not accept seconds of zero or below. Display an error message telling the user that "seconds must be greater than 0" should they violate this rule.

Only display the leading label when the value of days, hours, minutes or seconds is more than zero.

For example, assuming the user enters 36011 for the seconds, the output should be:

Hour(s): 10 Second(s): 11 

.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions