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;
}
}
-
[ios] 아이폰용 앱 오픈 소스들
-
[ios] 언어, 지역, 국가 설정 가져오기
-
자주 쓰는 Docker 명령어 alias
-
[ios] Start developing your navigation app for CarPlay without enrollment
-
[android] 만화 어플 소스코드
-
레고 마인드스톰 NXT 수도쿠, 큐브 소스코드..
-
[c#] Hashtable <-> Json (dll 포함)
-
[C#] MD5, SHA1 해시 & 인코딩
-
[android] 점심 해결 앱 소스 코드 ㅋㅋ
-
[json] 종결자 (설명과 웹, C/C++/C# 프로그램 샘플 코드)
-
[android] keytool을 사용하여 키스토어 생성
-
[ios] Random Thoughts: Rand() vs. arc4random()