Contents

Develop
2003.04.23 09:50

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

조회 수 16298 댓글 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. [web] 웹 연동 프로그램 모음..

    Date2013.04.23 CategoryDevelop Byhooni Views6961
    Read More
  2. [c] 웅지학원 NAT를 소스코드로..

    Date2013.04.23 CategoryDevelop Byhooni Views6612
    Read More
  3. [c] 소켓 스트림 서버/클라이언트 (UDP)

    Date2013.04.23 CategoryDevelop Byhooni Views7601
    Read More
  4. [c++] 마방진 소스코드

    Date2013.04.23 CategoryDevelop Byhooni Views9559
    Read More
  5. [c] 민수형 소스(도메인소켓포함)

    Date2013.04.23 CategoryDevelop Byhooni Views6524
    Read More
  6. [c] GD라이브러리(jpeg)를 사용한 웹 카운터 샘플

    Date2013.04.23 CategoryDevelop Byhooni Views15108
    Read More
  7. JSON, BSON 변환

    Date2013.04.23 CategoryDevelop Byhooni Views11815
    Read More
  8. [js] 2차 잉여.. (Quadratic reciprocity) 계산..

    Date2013.04.23 CategoryDevelop Byhooni Views7078
    Read More
  9. [js] 네이버, 다음의 플레이어 스킨

    Date2013.04.23 CategoryDevelop Byhooni Views6943
    Read More
  10. [js] 윈도우 시작버튼처럼 나오는 메뉴

    Date2013.04.23 CategoryDevelop Byhooni Views6744
    Read More
  11. [c] 맵서치인 듯(옛날 컴에서 찾은 자료)

    Date2013.04.23 CategoryDevelop Byhooni Views6905
    Read More
  12. [switch] 시스코 스위치(catalyst 2950) telnet 설정

    Date2013.04.23 CategoryDevelop Byhooni Views11273
    Read More
Board Pagination Prev 1 ... 46 47 48 49 50 51 52 53 54 55 ... 71 Next
/ 71