Contents

Develop
2003.04.23 09:50

[c++] p.58 연습문제 2번

조회 수 16296 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
#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;
        }

?

  1. [sql] 간단한 SQL 문법 정리

  2. [c] 그래픽스 자료(OpenGL 라이브러리) 샘플 소스

  3. [opengl] 컴퓨터 그래픽스 강의 자료(수업자료)

  4. [c++] p.47 연습문제 3번

  5. [c++] p.58 연습문제 2번

  6. [c++] p.118 확인학습 5번

  7. [c] 프로그래밍 ppt, 스킬업 (비트 수업자료)

  8. [linux] 콘솔/Xwindow 에서 PC스피커 소리 없애기

  9. [mysql] 쓰레드가 계속 쌓이기 시작하고 사라지지 않을때..

  10. [linux] 쉘 환경변수 PS1(프롬프트)

  11. [linux] APM(apache, php, mysql) + gd 설치순서..

  12. [linux] 메일서버 세팅정보(sendmail)

Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 98 Next
/ 98