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. [js] 파이어폭스(Firefox;F/F)에서 outerHTML 작동하도록 만든 메소드

    Date2013.04.23 CategoryDevelop Byhooni Views16445
    Read More
  2. 개발자가 알아야할 10가지 보안팁으로 코드 보호하기

    Date2013.04.23 CategoryEtc Byhooni Views16403
    Read More
  3. [linux] 메타(기호)문자의 의미와 사용

    Date2003.04.23 CategorySystem/OS Byhooni Views16394
    Read More
  4. 프로그램 문서 관리 (Doxygen)

    Date2013.04.23 CategoryDevelop Byhooni Views16391
    Read More
  5. [linux] 콘솔/Xwindow 에서 PC스피커 소리 없애기

    Date2003.04.23 CategorySystem/OS Byhooni Views16354
    Read More
  6. [php] 싸이월드 이미지 외부 링크 하기(php)

    Date2013.04.23 CategoryEtc Byhooni Views16351
    Read More
  7. [android] 안드로이드 어플 모음 ㅎㅎ

    Date2013.04.23 CategoryDevelop Byhooni Views16340
    Read More
  8. [linux] 패킷 스니퍼링

    Date2003.04.23 CategorySystem/OS Byhooni Views16323
    Read More
  9. [windows] 원격 데스크탑(터미널 서비스) 포트 변경

    Date2013.04.23 CategorySystem/OS Byhooni Views16305
    Read More
  10. [c++] p.58 연습문제 2번

    Date2003.04.23 CategoryDevelop Byhooni Views16298
    Read More
  11. [flash] 페이지 이동 (액션스크립트)

    Date2013.04.23 CategoryEtc Byhooni Views16263
    Read More
  12. [c] 네트워크 정보 알아보기

    Date2013.04.23 CategoryDevelop Byhooni Views16123
    Read More
Board Pagination Prev 1 ... 16 17 18 19 20 21 22 23 24 25 ... 98 Next
/ 98