rafasfas

mail@pastecode.io avatar
unknown
c_cpp
5 months ago
765 B
1
Indexable
#include <iostream>
#include <ctime>
#include <iomanip>
using namespace std;
void sekonda_kaluar(time_t start_time, time_t end_time){
        double sekonda_kaluar=difftime(end_time, start_time);
        int ora = static_cast<int>(sekonda_kaluar)/3600;
        int minutat = static_cast<int>(sekonda_kaluar)%3600/60;
        int sekondat = static_cast<int>(sekonda_kaluar)%60;
        cout<<"Koha e kaluar eshte :"<<endl;
        cout<<ora<<" :: "<<minutat<<" :: "<<sekondat<<endl;
}
int main() {
    cout<<"Shtyp butonin Enter qe te nise kronometri.";
    cin.get();
    time_t start_time=time(nullptr);
    cout<<"Shtyp prap Enter po te duash ta ndalosh";
    cin.get();
    time_t end_time=time(nullptr);
    sekonda_kaluar(start_time, end_time);
    return 0;
}
Leave a Comment