C++ 55

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

[C++]명품 C++ 프로그래밍 실습문제 8장 2번 [C++]명품 C++ programming 실습문제 8장 2번 명품 C++ 프로그래밍실습문제/연습문제 /C++ #include #include #include #include using namespace std; class Circle{ int radious; public: Circle (int radious = 0) {this->radious = radious;} int getRadious(){return radious;} void setRadious(int radious){this->radious = radious;} double getArea(){return 3.14*radious*radious;} }; class NameCircle : publi..

C++ 2023.01.13

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

[C++]명품 C++ 프로그래밍 실습문제 8장 [C++]명품 C++ programming 실습문제 8장 명품 C++ 프로그래밍실습문제/연습문제 /C++ //chhead.cpp part #include "chhead.h" #include #include int Product::getID(){return ProductID;} string Product::getdes(){return description;} int Product::getprice(){return price;} string Product::getPd(){return producer;} string Book:: getTitle(){return Booktitle;} string Book::getAuth(){return AuthorName;} str..

C++ 2023.01.13

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

[C++]명품 C++ 프로그래밍 실습문제 7장 12번 [C++]명품 C++ programming 실습문제 7장 12번 명품 C++ 프로그래밍실습문제/연습문제 /C++ #include #include #include #include using namespace std; class SortedArray{ int *p; int size; void sort(){ int tmp; for(int i=0 ; ip = NULL; this->size=0; } SortedArray(int p[],int size){ this->p = new int [size]; this->size = size; for(int i=0; ip[i] = p[i]; } SortedArray(SortedArray &copy){//복사 생성자 개념 ..

C++ 2023.01.11

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

[C++]명품 C++ 프로그래밍 실습문제 7장 10번 [C++]명품 C++ programming 실습문제 7장 10번 명품 C++ 프로그래밍실습문제/연습문제 /C++ #include #include #include #include using namespace std; class statistics{ int *p; //동적할당을 받을 배열이다. int count=0; public: statistics(){ p = new int [10]; } statistics &operator count==0) return true; else return false; } void operator ~(){ for(int i=0 ; i

C++ 2023.01.11

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

[C++]명품 C++ 프로그래밍 실습문제 7장 7번 [C++]명품 C++ programming 실습문제 7장 7번 명품 C++ 프로그래밍실습문제/연습문제 /C++ //7-1 #include #include #include #include using namespace std; class Matrix{ int matrix[100]; public: Matrix(int a=0,int b=0,int c=0,int d=0){ matrix[0] = a; matrix[1] = b; matrix[2] = c; matrix[3] = d; } void operator>>(int *r){ for(int i=0; imatrix[i] ; } } void operator

C++ 2023.01.11

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

[C++]명품 C++ 프로그래밍 실습문제 7장 6번 [C++]명품 C++ programming 실습문제 7장 6번 명품 C++ 프로그래밍실습문제/연습문제 /C++ //6-1 #include #include #include #include using namespace std; class Matrix{ int matrix[100]; public: Matrix(int a=0,int b=0,int c=0,int d=0){ matrix[0] = a; matrix[1] = b; matrix[2] = c; matrix[3] = d; } Matrix operator+(Matrix &r) //멤버함수로 설정해서 보기 { Matrix tmp; for(int i=0;imatrix[i]; } return tmp; } Matr..

C++ 2023.01.11

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

[C++]명품 C++ 프로그래밍 실습문제 7장 5번 [C++]명품 C++ programming 실습문제 7장 5번 명품 C++ 프로그래밍실습문제/연습문제 /C++ //5-1 #include #include #include #include // 외부함수 using namespace std; class Color{ int red; int green; int blue; public: Color(int red=0, int green=0 ,int blue=0){ this -> red =red; this -> green =green; this -> blue =blue; } Color operator+(Color &op2){ Color tmp; tmp.red = this->red + op2.red; tmp.green..

C++ 2023.01.11