Odpowiedź :
Odpowiedź:
#include <iostream>
using namespace std;
int convertToMin(int h)
{
if (h >= 0)
return h * 60;
return -1;
}
int convertToSec(int h)
{
if (h >= 0)
return h * 3600;
return -1;
}
int main(int argc, char const *argv[])
{
int h;
cout << "Podaj godziny do przekonwertowania" << endl;
cin >> h;
if (convertToMin(h) != -1)
cout << h << " godzin to: " << convertToMin(h) << " min lub " << convertToSec(h) << " sekund";
else
cout << "Podano wartosc ujemna" << endl;
return 0;
}
Wyjaśnienie:
Coś takiego poczyniłem