Develop
2003.04.23 09:50
[c++] p.58 연습문제 2번
조회 수 16296 댓글 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;
}
}
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
841 | Develop | [ios] 아이폰용 앱 오픈 소스들 | hooni | 2013.04.23 | 466366 |
840 | Develop | [ios] 언어, 지역, 국가 설정 가져오기 | hooni | 2014.05.12 | 269432 |
839 | Develop | 자주 쓰는 Docker 명령어 alias | hooni | 2020.01.10 | 268884 |
838 | Develop | [ios] Start developing your navigation app for CarPlay without enrollment | hooni | 2020.02.22 | 124637 |
837 | Develop | [android] 만화 어플 소스코드 | hooni | 2013.04.23 | 92834 |
836 | Develop | 레고 마인드스톰 NXT 수도쿠, 큐브 소스코드.. 20 | hooni | 2013.04.23 | 81384 |
835 | Develop | [c#] Hashtable <-> Json (dll 포함) | hooni | 2013.04.23 | 80650 |
834 | Develop | [C#] MD5, SHA1 해시 & 인코딩 | hooni | 2013.04.23 | 77852 |
833 | Develop | [android] 점심 해결 앱 소스 코드 ㅋㅋ | hooni | 2013.04.23 | 76394 |
832 | Develop | [json] 종결자 (설명과 웹, C/C++/C# 프로그램 샘플 코드) | hooni | 2013.04.23 | 71969 |
831 | Develop | [android] keytool을 사용하여 키스토어 생성 | hooni | 2013.04.23 | 69508 |
830 | Develop | [ios] Random Thoughts: Rand() vs. arc4random() | hooni | 2013.10.31 | 68033 |