Develop
2003.04.23 09:50
[c++] p.58 연습문제 2번
조회 수 16296 댓글 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;
}
}
-
[js]모바일 웹에서 orientationchange
-
정보시스템(정보보안)의 위험관리 설명
-
나중에 해봐야지.. libconv 설치.. ㅡ,.ㅡ;
-
[mysql] MySQL server has gone away 에러 대응
-
모터에 대한 pid 제어.. ㅎㅎ
-
[linux] APM(apache, php, mysql) + gd 설치순서..
-
URI 인코딩, URL 인코딩
-
[mac] 컨텍스트(Context) 메뉴 "다음으로 열기" 내용 정리
-
[linux] 패킷의 소스 주소 바꾸기
-
[ios] Objective-C에서 형식이 있는 문자열(Format Strings)에 사용할 수 있는 토큰들(Tokens)
-
[ios] libxml/tree.h file not found
-
[mysql] 접속과 테이블 생성 간단한 설명..