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. [js]모바일 웹에서 orientationchange

    Date2013.04.23 CategoryDevelop Byhooni Views19360
    Read More
  2. 정보시스템(정보보안)의 위험관리 설명

    Date2013.04.23 CategoryEtc Byhooni Views19339
    Read More
  3. 나중에 해봐야지.. libconv 설치.. ㅡ,.ㅡ;

    Date2013.04.23 CategorySystem/OS Byhooni Views19284
    Read More
  4. [mysql] MySQL server has gone away 에러 대응

    Date2013.05.29 CategorySystem/OS Byhooni Views19226
    Read More
  5. 모터에 대한 pid 제어.. ㅎㅎ

    Date2013.04.23 CategoryDevelop Byhooni Views18880
    Read More
  6. [linux] APM(apache, php, mysql) + gd 설치순서..

    Date2003.04.23 CategorySystem/OS Byhooni Views18852
    Read More
  7. URI 인코딩, URL 인코딩

    Date2013.04.23 CategoryDevelop Byhooni Views18850
    Read More
  8. [mac] 컨텍스트(Context) 메뉴 "다음으로 열기" 내용 정리

    Date2013.07.10 CategorySystem/OS Byhooni Views18798
    Read More
  9. [linux] 패킷의 소스 주소 바꾸기

    Date2003.04.23 CategorySystem/OS Byhooni Views18792
    Read More
  10. [ios] Objective-C에서 형식이 있는 문자열(Format Strings)에 사용할 수 있는 토큰들(Tokens)

    Date2013.04.23 CategoryDevelop Byhooni Views18787
    Read More
  11. [ios] libxml/tree.h file not found

    Date2013.08.08 CategoryDevelop Byhooni Views18709
    Read More
  12. [mysql] 접속과 테이블 생성 간단한 설명..

    Date2003.04.23 CategoryDatabase Byhooni Views18655
    Read More
Board Pagination Prev 1 ... 11 12 13 14 15 16 17 18 19 20 ... 98 Next
/ 98