#include<iostream.h>
#include<time.h>
#include<string.h>
class stopwatch{
clock_t c_start, c_end, st, k;
public :
stopwatch();
~stopwatch();
start();
stop(int i);
show();
};
stopwatch::stopwatch(){
}
stopwatch::~stopwatch(){
c_end = clock();
cout << "Bye~ : " << (int)( (c_end - c_start)/CLK_TCK ) << " secn";
}
stopwatch::show(){
c_end = clock();
cout << "Show time : " << (int)( (c_end - c_start)/CLK_TCK ) << " secn";
}
stopwatch::start(){
c_start = clock();
}
stopwatch::stop(int i){
if(i==0){
k = clock();
}else if(i==1){
st = clock();
st = st - k;
c_start = c_start + st;
}
}
int main(){
char com[10];
stopwatch ob;
cout << "Command: start, stop, exit n";
while(1){
cin >> com;
if(!strcmp(com, "start")) ob.start();
if(!strcmp(com, "stop")){
ob.stop(0);
cin >> com;
ob.stop(1);
}if(!strcmp(com, "show")) ob.show();
if(!strcmp(com, "exit")) return 0;
}
}