Turbo-C
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
터보-C 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
Lua 게시판
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C/C++ Q/A
[1019] 감사가 늦어서 죄송합니다... 감사합니다.(냉무)
jon76 [] 1654 읽음    2002-08-19 14:54
남병철.레조 님이 쓰신 글 :
: 안녕하세요? 레조입니다.
:
: 3가지 정도 수정후에 잘 컴파일 되어 화면이 나오네요.
: 결과는 이미지 첨부했습니다.
:
: void setTime( int h, int m, int s) {
: 이부분에 scope 연산자 없네요.
:
: << ( second < 10 ? "0" : "" ) << second MM ":"
: 이부분의 MM 오타 맞죠? ^^ << 이걸로 빠구시길..
:
: << ( hour < 12 ? "AM" : "PM"); endl;
: 이부분에서 ; 요걸 << 이걸루
:
: 이렇게 3개만 고치면 컴파일 됩니다.
:
: << time.h >>
: class Time {
:       public :
:            Time();
:            void setTime( int , int ,int);
:            void printMilitary();
:            void printStandard();
:       private :
:            int hour;
:            int minute;
:            int second;
: };
:
:
:
: << time.cpp >>
: #include <iostream>
: using std::cout;
: using std::endl;
:
: #include "time.h"
:
: Time::Time() { hour = minute = second = 0 ; }
:
: void Time::setTime( int h, int m, int s) {
:                   hour = ( ( h >=0 || h < 24 ) ? h : 0 );
:                   minute = ( ( m >=0 || m < 60) ? m : 0 );
:                   second = ( ( s >=0 || s < 60) ? s : 0 );
: }
:
: void Time::printMilitary() {
:                cout << ( hour < 10 ? "0" : "" ) << hour << ":"
:                        << ( minute < 10 ? "0" : "" ) << minute << endl;
: }
:
: void Time::printStandard() {
:                cout << (hour == 0 || hour == 12 ? 12 : hour) << ":"
:                        << ( minute < 10 ? "0" : "") << minute << ":"
:                        << ( second < 10 ? "0" : "" ) << second << ":"
:                        << ( hour < 12 ? "AM" : "PM") << endl;
: }
:
:
:
: << flg.cpp >>
: #include <iostream>
: using std::cout;
: using std::endl;
:
: #include "time.h"
:
: #include <conio.h>
:
:
: int main() {
:          Time t;
:
:          cout << "Initial Time\n";
:          t.printMilitary();
:          t.printStandard();
:
:          t.setTime( 13, 24, 23);
:
:          cout << "\nAfter time setting\n";
:          t.printMilitary();
:          t.printStandard();
:
:          t.setTime(99,99,99);
:          cout << "\nAfter Iilegal time setting\n";
:
:          t.printMilitary();
:          t.printStandard();
:
:          getch();
:
: }
:

+ -

관련 글 리스트
964 C++ 시작하는데 이것좀 읽어 주세요 jon76 1696 2002/08/09
969     Re:C++ 시작하는데 이것좀 읽어 주세요 남병철.레조 1789 2002/08/10
981         Re:Re:C++ 시작하는데 이것좀 읽어 주세요 jon76 1689 2002/08/11
986             Re:Re:Re:C++ 시작하는데 이것좀 읽어 주세요 남병철.레조 1548 2002/08/12
1019                 감사가 늦어서 죄송합니다... 감사합니다.(냉무) jon76 1654 2002/08/19
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.