Develop
2003.04.23 09:50
[c++] p.58 연습문제 2번
Views 17408 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 |
---|---|---|---|---|---|
1177 | Develop | [ios] 아이폰용 앱 오픈 소스들 | hooni | 2013.04.23 | 488235 |
1176 | Develop | [ios] 언어, 지역, 국가 설정 가져오기 | hooni | 2014.05.12 | 290782 |
1175 | Develop | 자주 쓰는 Docker 명령어 alias | hooni | 2020.01.10 | 289416 |
1174 | Etc |
베지어 곡선 (Bezier curve)
![]() |
hooni | 2013.08.18 | 238857 |
1173 | Develop |
[ios] Start developing your navigation app for CarPlay without enrollment
![]() |
hooni | 2020.02.22 | 132673 |
1172 | Etc | [link] 유용한 사이트 링크. | hooni | 2013.08.19 | 129990 |
1171 | Develop |
[android] 만화 어플 소스코드
![]() |
hooni | 2013.04.23 | 96718 |
1170 | Algorithm | 디피헬만(Diffie-Hellman) 초간단 개념.. | hooni | 2013.04.23 | 85679 |
1169 | Develop |
[c#] Hashtable <-> Json (dll 포함)
![]() |
hooni | 2013.04.23 | 84617 |
1168 | Develop |
레고 마인드스톰 NXT 수도쿠, 큐브 소스코드..
20 ![]() |
hooni | 2013.04.23 | 83093 |
1167 | Develop |
[android] 점심 해결 앱 소스 코드 ㅋㅋ
![]() |
hooni | 2013.04.23 | 81363 |
1166 | Develop | [C#] MD5, SHA1 해시 & 인코딩 | hooni | 2013.04.23 | 80939 |