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. [mysql] 쓰레드가 계속 쌓이기 시작하고 사라지지 않을때..

    Date2003.04.23 CategoryDatabase Byhooni Views12787
    Read More
  2. [linux] 쉘 환경변수 PS1(프롬프트)

    Date2003.04.23 CategorySystem/OS Byhooni Views13492
    Read More
  3. [linux] APM(apache, php, mysql) + gd 설치순서..

    Date2003.04.23 CategorySystem/OS Byhooni Views18851
    Read More
  4. [linux] 메일서버 세팅정보(sendmail)

    Date2003.04.23 CategorySystem/OS Byhooni Views17407
    Read More
  5. [linux] 웹로그분석기(webalizer) 설치 & 팁

    Date2003.04.23 CategorySystem/OS Byhooni Views14882
    Read More
  6. [linux] 데스크탑환경(GNOME/KDE) 바꾸기..

    Date2003.04.23 CategorySystem/OS Byhooni Views12101
    Read More
  7. [linux] 센드메일 동적릴레이 설치

    Date2003.04.23 CategorySystem/OS Byhooni Views15228
    Read More
  8. HTTP 프로토콜 (브라우저와 웹서버 간의 통신)

    Date2003.04.23 CategorySystem/OS Byhooni Views48250
    Read More
  9. [mysql] DB->Text, Text->DB 변환

    Date2003.04.23 CategoryDatabase Byhooni Views12129
    Read More
  10. [windows] 패스워드를 잊어먹었을때..

    Date2003.04.23 CategorySystem/OS Byhooni Views17294
    Read More
  11. [bios] 시스템 부팅 도중 발생하는 비프음

    Date2003.04.23 CategorySystem/OS Byhooni Views18158
    Read More
  12. [unix] SUN Solaris 싱글모드.. ㅡ,.ㅡ;

    Date2003.04.23 CategorySystem/OS Byhooni Views11991
    Read More
  13. [linux] ProFTPD 타임아웃 설정

    Date2003.04.23 CategorySystem/OS Byhooni Views12851
    Read More
  14. [css] 스크롤바 안생기게

    Date2003.04.23 CategoryDevelop Byhooni Views9886
    Read More
  15. [unix] 유닉스 csh에서 환경변수 등록

    Date2003.04.23 CategorySystem/OS Byhooni Views11697
    Read More
  16. [linux] 쉘 스크립트 (Shell Script)

    Date2003.04.23 CategorySystem/OS Byhooni Views12064
    Read More
Board Pagination Prev 1 2 3 4 5 ... 74 Next
/ 74