Develop
2003.04.23 09:50
[c++] p.58 연습문제 2번
Views 16523 Comment 0
#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;
}
}
-
[mysql] 쓰레드가 계속 쌓이기 시작하고 사라지지 않을때..
-
[linux] 콘솔/Xwindow 에서 PC스피커 소리 없애기
-
[c] 프로그래밍 ppt, 스킬업 (비트 수업자료)
-
[c++] p.118 확인학습 5번
-
[c++] p.58 연습문제 2번
-
[c++] p.47 연습문제 3번
-
[opengl] 컴퓨터 그래픽스 강의 자료(수업자료)
-
[c] 그래픽스 자료(OpenGL 라이브러리) 샘플 소스
-
[sql] 간단한 SQL 문법 정리
-
[c] 간단한 채팅(클라이언트/서버) 프로그램 소스
-
[c] 팩토리얼.. - 재귀함수
-
[c] 하노이탑 - 재귀함수