samedi 23 octobre 2021

how can i display the actual input from the user even after arithmetic operations?

const int SCND_TO_HOUR = 3600, SCND_TO_MINUTE = 60; //constant declaration
int seconds,hour,minute,remainSeconds;
cout << "Input the total time in seconds : " << endl;
cin >> seconds;
hour = seconds / SCND_TO_HOUR;
seconds = seconds % SCND_TO_HOUR;
minute = seconds / SCND_TO_MINUTE;
seconds = seconds % SCND_TO_MINUTE;
remainSeconds = seconds;

//the display is suppossed to be user input seconds are equals to .... cout << seconds << " seconds are equals to " << hour << " hours " << minute << " minutes and " << remainSeconds<< "seconds" << endl;

Aucun commentaire:

Enregistrer un commentaire