Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
759 B
0
Indexable
Never
#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 minuta = (static_cast<int>(sekonda_kaluar)%3600)/60; 
    int sekonda = static_cast<int>(sekonda_kaluar)%60;
    cout<<"Time spend is : "<<endl;
    cout<<ora<<" :: "<<minuta<< " :: "<<sekonda<<endl;
}



int main() {
    cout<<"Press button enter to start Time"<<endl;
    cin.get();
    time_t start_time=time(nullptr);
    cout<<"OK it has startet.Press enter to stop it"<<endl;
    cin.get();
    time_t end_time=time(nullptr);
    sekonda_kaluar(start_time , end_time);
    
    return 0;
}
Leave a Comment