31 lines
589 B
C++
31 lines
589 B
C++
#include <iostream>
|
|
#include <cmath>
|
|
|
|
using namespace std;
|
|
|
|
void calculate (int a) {
|
|
|
|
int hours, minutes, seconds;
|
|
|
|
hours = (a / 3600);
|
|
minutes = (a / 60) - (hours * 60);
|
|
seconds = a % 60;
|
|
|
|
cout << "hours: " << hours << " minutes: " << minutes << " seconds: " << seconds << endl;
|
|
|
|
};
|
|
|
|
|
|
int main() {
|
|
|
|
int time;
|
|
cout << "please enter a number of seconds" << endl;
|
|
cin >> time;
|
|
cout << time << endl;
|
|
cout << "absolute value of input " << abs (time) << endl;
|
|
calculate(time);
|
|
cout << "now with sqrt: " << endl;
|
|
calculate(sqrt(time));
|
|
}
|
|
|