Develop
2003.04.23 09:50
[c++] p.58 연습문제 2번
조회 수 16351 댓글 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;
}
}
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
145 | Develop | [matlab] ZigZag-Scanning (2-D Array) | hooni | 2016.10.15 | 2115 |
144 | Develop | [c#] MS IE(Internet Explorer) 툴바 버튼 예제 2003/2005 두가지 버전 | hooni | 2013.04.23 | 2090 |
143 | Develop | [c#] mfc 기반의 웹서비스 서버/클라이언트 샘플과 예제 소스 | hooni | 2013.04.23 | 2073 |
142 | Develop | [swift] UIView에서 subview 찾기 | hooni | 2022.12.09 | 2053 |
141 | Develop | [ios] 웹뷰 history.back() ㅋㄷ | hooni | 2016.06.27 | 2037 |
140 | Develop | [iOS] 시뮬레이터에 푸시 알림을 보내는 방법 | hooni | 2021.10.13 | 2012 |
139 | Develop | [android] 가속도 센서를 이용한 흔듦(Shake) 감지 | hooni | 2014.11.04 | 2004 |
138 | Develop | [ios] Objective-C 에서 자주 사용하는 수학 함수와 유용한 Define | hooni | 2014.08.08 | 1995 |
137 | Develop | [iOS] Xcode 불필요한 캐시 삭제하기 | hooni | 2021.10.12 | 1983 |
136 | Develop | [ios] 카메라 사용 권한 확인해서 분기하는 방법 | hooni | 2015.02.26 | 1958 |
135 | Develop | [ios] Xcode cannot run using the selected device | hooni | 2014.08.14 | 1924 |
134 | Develop | [php] mysql_ 과 mysqli_ 의 차이 | hooni | 2017.12.01 | 1848 |