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 |
---|---|---|---|---|---|
165 | Develop |
[c++] WinSock2.0 채팅 프로그램 ㅋㅋ
![]() |
hooni | 2013.04.23 | 8566 |
164 | Develop |
[c++] Window API(MFC) 오목 게임
![]() |
hooni | 2003.04.23 | 10322 |
163 | Develop | [c++] Win32API를 이용한 ExitWindowsEx 사용한 예제코드 | hooni | 2013.04.23 | 8000 |
162 | Develop |
[c++] Win32 API 기본 출력인 MessageBox() 함수 사용 예제..
![]() |
hooni | 2013.04.23 | 12720 |
161 | Develop | [c++] template 사용예 | hooni | 2003.04.23 | 7207 |
160 | Develop | [c++] String Tokenizer (나중에 c 코드로 변경해서 사용할 것) | hooni | 2013.04.23 | 11731 |
159 | Develop |
[c++] SetWindowPos함수를 이용한 크기조절 예제
1 ![]() |
hooni | 2013.04.23 | 11118 |
158 | Develop | [c++] RSA Sample 4 CPP | hooni | 2013.04.23 | 9249 |
» | Develop | [c++] p.58 연습문제 2번 | hooni | 2003.04.23 | 16356 |
156 | Develop | [c++] p.47 연습문제 3번 | hooni | 2003.04.23 | 10150 |
155 | Develop | [c++] p.118 확인학습 5번 | hooni | 2003.04.23 | 10776 |
154 | Develop | [c++] namespace 사용 예 | hooni | 2003.04.23 | 8712 |