Develop
2003.04.23 09:50
[c++] p.58 연습문제 2번
Views 16356 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 |
---|---|---|---|---|---|
1017 | Develop | [android] How can I place app icon on launcher home screen? | hooni | 2016.11.15 | 1422 |
1016 | System/OS | [linux] yum 업데이트 시 커널 제외하기 | hooni | 2014.09.11 | 1425 |
1015 | Develop | [vim] vim 명령으로  문자 제거하기 (remove 65279 bomb) | hooni | 2021.02.03 | 1441 |
1014 | Develop | [c] Mac OS 에 gmp(gmp.h) 라이브러리 설치 | hooni | 2016.10.03 | 1452 |
1013 | Develop | [js] URL 파싱하기 (jQuery 안쓰고) | hooni | 2017.12.14 | 1456 |
1012 | Develop | [php] 한글 문자열 자르기 (utf-8) | hooni | 2015.11.10 | 1468 |
1011 | Etc |
영어. 반드시 외워야 할 문장 패턴 100개
![]() |
hooni | 2023.06.08 | 1469 |
1010 | PPT |
[ppt] 전자금융보안론 발표/설치 자료
![]() |
hooni | 2016.05.03 | 1470 |
1009 | Develop | [ios] How to set up clang formatter | hooni | 2015.09.17 | 1478 |
1008 | Develop | [android] 간단한 SQLIite 예제 | hooni | 2017.06.14 | 1478 |
1007 | System/OS |
[mac] Mac OS 패키지 매니저, HomeBrew
![]() |
hooni | 2015.01.03 | 1480 |
1006 | Develop |
macOS에 node, npm 설치하기 (homebrew)
![]() |
hooni | 2021.11.06 | 1481 |