Skip to content

ex5

← Back

Basic Info

Computer Programming 1
└── Lecture 10 LAB Basic Concepts InputStream
    └── ex5.cpp

Preview

using namespace std;
#include <iostream>

int main(){
    int t;
    cout << "Please input current time: ";
    cin >> t;

    int s = t%60, m = t%3600/60, h = t/3600;

    cout << "Hour: " << h << endl;
    cout << "Minute: " << m << endl;
    cout << "Second: " << s << endl;

    return 0;
}