Develop
2003.04.23 09:50
[c++] p.58 연습문제 2번
조회 수 16302 댓글 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;
}
}
-
[C] C언어의 조건 연산자(Conditional Operator)
-
[c] 파일입출력 간단한 설명
-
[c] home env stack overflow
-
[c] scanf(), printf() 포맷의 형변환
-
[c] CGI Library to C^^
-
[c] 간단한 링크드 리스트(linked list) 자료형 예제..
-
[php] whois정보 조회 프로그램
-
[c] 최대공약수 알고리즘 (유클릿)
-
[c] 소수점 반올림^^
-
[c] 하노이탑 - 재귀함수
-
[c] 팩토리얼.. - 재귀함수
-
[c] 간단한 채팅(클라이언트/서버) 프로그램 소스