etc./열혈 C++ 프로그래밍

    (열혈 C++ 프로그래밍) OOP 단계별 프로젝트 03단계

    (열혈 C++ 프로그래밍) OOP 단계별 프로젝트 03단계

    #include #include using namespace std; const int NAME_LEN=20; void ShowMenu(void); // 메뉴출력 void MakeAccount(void); // 계좌개설을 위한 함수 void DepositMoney(void); // 입 금 void WithdrawMoney(void); // 출 금 void ShowAllAccInfo(void); // 잔액조회 enum {MAKE=1, DEPOSIT, WITHDRAW, INQUIRE, EXIT}; class Account { private: int accID; // 계좌번호 int balance; // 잔 액 char * cusName; // 고객이름 public: Account(int ID, int mon..

    (열혈 C++ 프로그래밍) 문제 05-1

    (열혈 C++ 프로그래밍) 문제 05-1

    복사 생성자의 정의 문제1 #define _CRT_SECURE_NO_WARNINGS #include using namespace std; namespace COMP_POS { enum { CLERK, SENIOR, ASSIST, MANAGER }; void ShowPositionInfo(int pos) { switch (pos) { case CLERK: cout

    (열혈 C++ 프로그래밍) OOP 단계별 프로젝트 02단계

    (열혈 C++ 프로그래밍) OOP 단계별 프로젝트 02단계

    #include #include using namespace std; const int NAME_LEN = 20; void ShowMenu(void); // 메뉴출력 void MakeAccount(void); // 계좌개설을 위한 함수 void DepositMoney(void); // 입 금 void WithdrawMoney(void); // 출 금 void ShowAllAccInfo(void); // 잔액조회 enum { MAKE = 1, DEPOSIT, WITHDRAW, INQUIRE, EXIT }; class Account { private: int accID; // 계좌번호 int balance; // 잔 액 char* cusName = new char[NAME_LEN]; // 고객이름 publi..

    (열혈 C++ 프로그래밍) 문제 04-3

    (열혈 C++ 프로그래밍) 문제 04-3

    C++ 기반의 데이터 입출력 문제1 #include using namespace std; class Point { private: int xpos, ypos; public: Point(int x, int y) : xpos(x), ypos(y) {} void ShowPointInfo() const { cout

    (열혈 C++ 프로그래밍) 문제 04-2

    (열혈 C++ 프로그래밍) 문제 04-2

    다양한 클래스의 정의 문제1 #include using namespace std; class Point { private: int xpos, ypos; public: void Init(int x, int y){ xpos = x; ypos = y; } void ShowPointInfo() const { cout

    (열혈 C++ 프로그래밍) 문제 04-1

    (열혈 C++ 프로그래밍) 문제 04-1

    정보은닉과 const 문제1 #include using namespace std; class FruitSeller { private: int APPLE_PRICE; int numOfApples; int myMoney; public: void InitMembers(int price, int num, int money) { if (price < 0 || num < 0 || money < 0) { cout

    (열혈 C++ 프로그래밍) 문제 03-2

    (열혈 C++ 프로그래밍) 문제 03-2

    클래스의 정의 문제1 #include using namespace std; class Calculator { private: int countAdd, countMin, countMul, countDiv; public: void Init(); double Add(double, double); double Min(double, double); double Mul(double, double); double Div(double, double); void ShowOpCount(); }; inline void Calculator::Init() { countAdd = 0; countMin = 0; countMul = 0; countDiv = 0; } inline double Calculator::Add(double ..

    (열혈 C++ 프로그래밍) 문제 03-1

    (열혈 C++ 프로그래밍) 문제 03-1

    구조체 내에 함수 정의하기 문제1 #include using namespace std; struct Point { int xpos; int ypos; void MovePos(int x, int y) { xpos += x; ypos += y; } void AddPoint(const Point& pos) { xpos += pos.xpos; ypos += pos.ypos; } void ShowPosition() { cout

    (열혈 C++ 프로그래밍) 문제 02-4

    (열혈 C++ 프로그래밍) 문제 02-4

    C++의 표준함수 호출 문제1 #include #include using namespace std; int main(void) { char tmp1[10] = "abcde"; char tmp2[10] = "fgha"; cout

    (열혈 C++ 프로그래밍) 문제 02-3

    (열혈 C++ 프로그래밍) 문제 02-3

    구조체에 대한 new & delete 연산 문제1 #include using namespace std; typedef struct __Point { int xpos; int ypos; } Point; Point& PntAdder(const Point& p1, const Point& p2) { Point *tmp = new Point; tmp->xpos = p1.xpos + p2.xpos; tmp->ypos = p1.ypos + p2.ypos; return *tmp; } int main(void) { Point* p1 = new Point; // Point 자료형을 가리키는 포인터 p1 Point* p2 = new Point; // Point 자료형을 가리키는 포인터 p2 p1->xpos = 1; p1->..