Develop
2003.04.23 09:50
[c++] p.58 연습문제 2번
Views 16296 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;
}
}
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
165 | System/OS | [router] 시스코 라우터 명령어 모드.. | hooni | 2013.04.23 | 12946 |
164 | Algorithm | [security] RSA 암호화 설명과 예.. | hooni | 2013.04.23 | 16618 |
163 | Algorithm | [security] 블럭 암호에 대해서.. | hooni | 2013.04.23 | 17122 |
162 | Develop | [sh] html 안에 있는 img 다운 받는 쉘 스크립트 | hooni | 2020.05.26 | 643 |
161 | Develop | [sh] 쉘스크립트 if 비교 연산 | hooni | 2020.05.26 | 60657 |
160 | Develop | [spring] 스프링 IoC/DI | hooni | 2013.04.23 | 11349 |
159 | System/OS | [sql] alter table 쿼리 예제 | hooni | 2003.04.23 | 12459 |
158 | System/OS | [sql] insert into select 사용하기 | hooni | 2013.04.23 | 27556 |
157 | Database | [sql] 간단한 SQL 문법 정리 | hooni | 2003.04.23 | 12551 |
156 | Database | [sql] 간단한 통계 서브쿼리 예제.. | hooni | 2013.04.23 | 15088 |
155 | System/OS | [sql] 내 방명록 답글 찾는 쿼리문.. (JOIN 구문) | hooni | 2003.04.23 | 12845 |
154 | System/OS | [sql] 조회구문(select)에서 중복 데이터를 한 번만 출력 (distinct) 1 | hooni | 2013.04.23 | 33939 |