Concept explainers
(Assume the user enters 36720152. Use a calculator.)
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
long seconds;
double minutes, hours, days, months, years;
cout << "Enter the number of seconds that have\n”;
cout << "elapsed since some time in the past and\n
cout << "I will tell you how many minutes, hours,\n
cout << "days, months, and years have passed: ";
cin >> seconds;
minutes = seconds / 60;
hours = minutes / 60;
days = hours / 24;
years = days / 365;
months = years * 12;
cout << setprecision(4) << fixed << showpoint << right;
cout << "Minutes: " << setw(6) << minutes << endl;
cout << "Hours: " << setw(6) << hours << endl;
cout << "Days: " << setw(6) << days << endl;
cout << "Months: " << setw(6) << months << endl;
cout << "Years: " << setw(6) << years << endl;
return 0;
}
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
Additional Engineering Textbook Solutions
Artificial Intelligence: A Modern Approach
Modern Database Management (12th Edition)
C How to Program (8th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Digital Fundamentals (11th Edition)
Starting Out With Visual Basic (8th Edition)
- Program C Loop, pls help ASAP int getNum(); /*accepts input from the user.*/ void display(int num); /*prints the number pattern*/ ---------------------------------------------------------------------arrow_forwardWhen you perform arithmetic operations with operands of different types, such as adding an int and a float, ____________. C# chooses a unifying type for the result you must choose a unifying type for the result you must provide a cast you receive an error messagearrow_forward15. Write a program to implement and test the algorithm that you designed for Exercise 15 of Chapter 1. (You may assume that the value of . In your program, declare a named constant PI to store this value.)arrow_forward
- English (e what is the output of the following program? #include int test (int &, int); main () { int a=10, b=15; test (b, a); test (a,b); cout<arrow_forwardFilling the Pool (Deprecated) Write a program that calculates the time neccessary to completely fill an empty pool with water. We will assume that the pool is rectangular and the depth is uniform. All input values in this program will be integers. Prompt the user to enter the pool dimensions - length, width, and depth (unit: feet) - as well as the rate at which water can be put into the pool (unit: gallons per minute). Using these values, calculate and display the time (in minutes) needed to fill the pool from completely empty to completely full. Note: you should calculate the volume of the pool (as cubic feet) and then determine the rate (in cubic feet per minute) that water can be put into the pool. Assume that there are 7.48 gallons in one cubic foot. Your program should run like the examples shown below: Enter pool dimensions Length: 10 Width: 8 Depth: 7 Water entry rate: 14 The pool will fill completely in 299.2 minutesarrow_forward10. a. Point Out errors: #include void main() { char arr[8]="Rhombus"; int i; for(i=0;i #include void main() { char *str1="United"; char *str2="Front"; char *str3; str3=strcat(str1,str2); printf("\n %s",str3); [- [- c. Compare Union and Structure.arrow_forward#include #include #include #include #include using namespace std; int main (){ const double PI = 3.14159265359; return 0; }arrow_forward#include #include void main(void) {int number; Cout > number; if ( number > 100) cout <<" number is greater then 100" ; else cout <" number is not greater than 100" ;arrow_forwardWrite the following function to display three numbers in increasing order:def displaySortedNumbers(num1, num2, num3):Write a test program that prompts the user to enter three numbers and invokes the function to display them in increasing order.arrow_forwardWhat a solution with java language please ?arrow_forwardFunctions Exercise (Parking Charges) A parking garage charges a $2.00 minimum fee to park for one hour. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format and should calculate and print the total of yesterday's receipts. The program should use the function Charge to determine the charge for each customer. Car Hours Charge 1 2 Computer skills (Engineering) 3 1 4 24 TOTAL 2 8 10 20arrow_forwardC Language - Write a program whose inputs are three integers, and whose output is the smallest of the three values.arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,