Develop
2003.04.23 09:50
[c++] p.58 연습문제 2번
Views 16357 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 |
---|---|---|---|---|---|
33 | Develop |
macOS에 node, npm 설치하기 (homebrew)
![]() |
hooni | 2021.11.06 | 1481 |
32 | Develop |
Mac OS 에 Jenkins 설치하기 (Homebrew)
2 ![]() |
hooni | 2017.03.15 | 8411 |
31 | System/OS | Mac OS X - Apache+PHP+MySQL 환경 서버 | hooni | 2013.04.25 | 31733 |
30 | Develop | Laravel 5 Failed opening required bootstrap/../vendor/autoload.php | hooni | 2018.01.24 | 1844 |
29 | Develop |
JSON, BSON 변환
![]() |
hooni | 2013.04.23 | 11878 |
28 | Etc |
IT감사 기법 시험
![]() |
hooni | 2017.06.14 | 1638 |
27 | Etc |
ISMS 인증기준 – 정보보호대책 (시스템개발보안)
![]() |
hooni | 2016.12.01 | 1508 |
26 | System/OS |
iptime 공유기 해킹 기술문서
4 ![]() |
hooni | 2015.01.01 | 2094 |
25 | Etc |
IPR 특허 관련
![]() |
hooni | 2015.04.28 | 0 |
24 | Etc |
IoT가 만드는 미래와 플랫폼 경쟁력
![]() |
hooni | 2014.09.23 | 0 |
23 | Etc | iOS 에서 쓸만한 오프라인 구글지도 찾기 | hooni | 2014.01.06 | 16112 |
22 | System/OS |
HTTPS와 SSL 인증서
![]() |
hooni | 2014.03.11 | 7643 |