Develop
2003.04.23 09:50

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

Views 16296 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
#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. [c++] 인라인 함수 설명과 예제..

    Date2013.04.23 CategoryDevelop Byhooni Views6633
    Read More
  2. [c++] 인라인 함수에 대한 설명

    Date2013.04.23 CategoryDevelop Byhooni Views7110
    Read More
  3. [c++] 자료구조(링크리스트,스택,큐)와 후위 표기 계산기 샘플 ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views12318
    Read More
  4. [c++] 중복실행 방지(Mutex;뮤텍스 ) 샘플 소스.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views8737
    Read More
  5. [c++] 채팅로봇 소스.. ㅋㄷㅋㄷ

    Date2013.04.23 CategoryDevelop Byhooni Views8878
    Read More
  6. [c++] 초간단 스택 두 가지 방식(class, struct)

    Date2013.04.23 CategoryDevelop Byhooni Views7553
    Read More
  7. [c++] 템플릿(Template) 예제 소스..

    Date2013.04.23 CategoryDevelop Byhooni Views6976
    Read More
  8. [c++] 트리컨트롤 스텝 2 예제..

    Date2013.04.23 CategoryDevelop Byhooni Views6953
    Read More
  9. [c++] 트리컨트롤 스텝 3 예제..

    Date2013.04.23 CategoryDevelop Byhooni Views7943
    Read More
  10. [c++] 트리컨트롤 예제1 ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views7169
    Read More
  11. [c++] 퍼즐 버블버블 간단한 원리(사용공식)

    Date2013.04.23 CategoryDevelop Byhooni Views9958
    Read More
  12. [c++] 프리렉(freelec) 예제 자료.. ㅋㄷ

    Date2013.04.23 CategoryDevelop Byhooni Views6833
    Read More
  13. [c++] 헤더, 소스 파일 분리해서 작성해본 테스트 소스

    Date2013.04.23 CategoryDevelop Byhooni Views6688
    Read More
  14. [c++] 현승이가 준 P2P 프로그램 소스 ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views12064
    Read More
  15. [c++] 현승이가 준 메신저 소스.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views8266
    Read More
  16. [c++][mfc] 파일 입출력 샘플 (한줄씩 읽어서 다른 파일에 쓰기)

    Date2013.04.23 CategoryDevelop Byhooni Views14979
    Read More
Board Pagination Prev 1 ... 8 9 10 11 12 ... 53 Next
/ 53