C++ 55

[C++] 명품 C++ 프로그래밍 실습문제 9장 10번

[C++]명품 C++ 프로그래밍 실습문제 9장 10번 [C++]명품 C++ programming 실습문제 9장 10번 명품 C++ 프로그래밍실습문제/연습문제 /C++ //Circle.cpp #include "Circle.h" void Circle:: draw() { cout getNext(); } void GraphicEditor::deleteItem(int index) { Shape* pre = pStart; Shape* tmp = pStart; if (pStart == NULL) { cout getNext(); delete tmp; } else { pre->add(tmp->getNext()); delete tmp; } } void GraphicEditor::show() { Shape* tmp = pS..

C++ 2023.01.14

[C++] 명품 C++ 프로그래밍 실습문제 9장 9번

[C++]명품 C++ 프로그래밍 실습문제 9장 9번 [C++]명품 C++ programming 실습문제 9장 9번 명품 C++ 프로그래밍실습문제/연습문제 /C++ //Inkjet.cpp #include "Inkjet.h" int Inkjet::getavailabeInk(){return this->availabeInk;} void Inkjet:: print(int pages){ if(isValid(this->availablecount - pages)==true){ // 계산해주기 this-> printedcount = this->printedcount + pages; this-> availablecount = this->availablecount - pages; this-> availabeInk = thi..

C++ 2023.01.14

[C++] 명품 C++ 프로그래밍 실습문제 9장 7번

[C++]명품 C++ 프로그래밍 실습문제 9장 7번 [C++]명품 C++ programming 실습문제 9장 7번 명품 C++ 프로그래밍실습문제/연습문제 /C++ #include #include #include using namespace std; class Shape{ protected: string name; int width, heigth; public: Shape(string n = " " ,int W = 0,int h=0){name = n ; width = W; heigth =h;} virtual string getName(){return name; } virtual double getArea(){return 0;} }; class Oval : public Shape{ public: Oval(s..

C++ 2023.01.14

[C++] 명품 C++ 프로그래밍 실습문제 9장 5번

[C++]명품 C++ 프로그래밍 실습문제 9장 5번 [C++]명품 C++ programming 실습문제 9장 5번 명품 C++ 프로그래밍실습문제/연습문제 /C++ #include #include using namespace std; class AbstractGate { protected: bool x,y; public: void set(bool x, bool y){this->x =x; this->y=y;} virtual bool operation()=0; }; class ANDGate :public AbstractGate{ public: bool operation(){ return x&y; } }; class XORGate :public AbstractGate{ public: bool operation(..

C++ 2023.01.14

[C++] 명품 C++ 프로그래밍 실습문제 9장 4번

[C++]명품 C++ 프로그래밍 실습문제 9장 4번 [C++]명품 C++ programming 실습문제 9장 4번 명품 C++ 프로그래밍실습문제/연습문제 /C++ #include #include #include #include using namespace std; class LoopAdder { // 최상위 클래스 string name; int x,y,sum; void read(); void write(); protected: LoopAdder(string name= ""){this->name =name;} int getX(){return x;} int getY(){return y;} virtual int calculate()=0; public: virtual void run(); }; void Loop..

C++ 2023.01.14

[C++] 명품 C++ 프로그래밍 실습문제 9장 오픈챌린지/openchallenge

[C++]명품 C++ 프로그래밍 실습문제 9장 오픈챌린지/openchallenge [C++]명품 C++ programming 실습문제 9장 오픈챌린지/openchalleng 명품 C++ 프로그래밍실습문제/연습문제 /C++ //Food.h #pragma once #include "Gameobject.h" using namespace std; class Food : public GameObject { int count; public: Food(int starX, int starY, int dis) : GameObject(starX, starY, dis) { srand((unsigned)time(0)); count = 0; } void move(); char getShape() ; }; //Food.cpp #..

C++ 2023.01.14

[C++] 명품 C++ 프로그래밍 실습문제 8장 9번

[C++]명품 C++ 프로그래밍 실습문제 8장 9번 [C++]명품 C++ programming 실습문제 8장 9번 명품 C++ 프로그래밍실습문제/연습문제 /C++ 헤더파일과 cpp 파일을 따로 만들어 두었습니다. 잘활용하시길 바랍니다~ //header.cpp #include"header.h" #include using namespace std; int Console::select_menu() { cout > menu; return menu; } int Console::select_time(){ cout > time; return time; } int Console::input_seat_num() { cout > seat_num; if(seat_num n..

C++ 2023.01.13

[C++] 명품 C++ 프로그래밍 실습문제 8장 8번

[C++]명품 C++ 프로그래밍 실습문제 8장 8번 [C++]명품 C++ programming 실습문제 8장 8번 명품 C++ 프로그래밍실습문제/연습문제 /C++ 헤더파일과 cpp 파일을 따로 만들어 두었습니다. 잘활용하시길 바랍니다~ //header.cpp #include #include #include "header.h" bool Printer::isValid(int value) { if(value>0) return true; // 0보다 크면 트루를 리턴 else return false; // 0보다 작작으면 false 리턴 } int Printer::getPrintedcount(){return this->printedcount;}; int Printer::getavailablecount(){ret..

C++ 2023.01.13

[C++] 명품 C++ 프로그래밍 실습문제 8장 6번

[C++]명품 C++ 프로그래밍 실습문제 8장 6번 [C++]명품 C++ programming 실습문제 8장 6번 명품 C++ 프로그래밍실습문제/연습문제 /C++ #include #include using namespace std; class BaseArray { private: int capacity; int* mem; protected: BaseArray(int capacity = 100) { this->capacity = capacity; mem = new int[capacity]; } ~BaseArray() { delete[] mem; } void put(int index, int val) { mem[index] = val; } int get(int index) { return mem[index]..

C++ 2023.01.13

[C++] 명품 C++ 프로그래밍 실습문제 8장 4번

[C++]명품 C++ 프로그래밍 실습문제 8장 4번 [C++]명품 C++ programming 실습문제 8장 4번 명품 C++ 프로그래밍실습문제/연습문제 /C++ #include #include #include #include using namespace std; class Point { int x,y; public: Point(int x, int y){this->x =x;this->y=y;} int getX(){return x;} int getY(){ return y;} protected: void move(int x,int y){ this->x =x ; this-> y=y;} }; class Colorpoint : public Point{ string color; public: Colorpoint(i..

C++ 2023.01.13