분류 전체보기 162

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

[C++]명품 C++ programming 실습문제 7장 명품 C++ 프로그래밍실습문제/연습문제 /C++/히스토그램 #include #include #include #include using namespace std; class Histogram{ string Sen; public: Histogram(string sen){ this-> Sen = sen; } Histogram &operator Sen = this->Sen + sen; return *this; } Histogram &operator Sen = this->Sen + c; return *this; } void operator !() { int i, count=0; int alnum[26]; for(i=0;i

C++ 2023.01.11

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

[C++]명품 C++ 프로그래밍 실습문제 6장 8번 [C++]명품 C++ programming 실습문제 6장 8번 #include #include using namespace std; void f(); class Trace{ static string *s1;//tag 정보 저장 //static 선언하면 전역공간에서 구현을 간략히 해줘야 풀수가 있음 static string *s2;//내용 정보 저장 static int num; public: static void put(string tag, string imformation){ s1[num] = tag; s2[num] = imformation; num++; } static void print(string tag){ if( tag == "f()" ){ cout

C++ 2023.01.10

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

[C++]명품 C++ 프로그래밍 실습문제 6장 7번 [C++]명품 C++ programming 실습문제 6장 7번 명품 C++ 프로그래밍실습문제/연습문제 /C++ #include #include using namespace std; class Random{ public: static void send() {srand((unsigned)time(0));} // 난수생성함수 static int nextInt(int min=0, int max = 32767){ int res = rand()%32767 + 0; return res; } static char nextAlphabet(){ int i =rand()%2;//2로 나누면 0,1값이 랜덤으로 나온다 char randchar1,randchar2; if(i ..

C++ 2023.01.10

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

[C++]명품 C++ 프로그래밍 실습문제 6장 4번 [C++]명품 C++ programming 실습문제 6장 4번 명품 C++ 프로그래밍실습문제/연습문제 /C++ #include #include using namespace std; class MyVector{ int *mem; int size; public: MyVector(int n=100, int val=0); ~MyVector(){ delete [] mem;} int getNum(){size = size ;return size;} void getarr(int j){ printf("%d",mem[j]);} }; MyVector::MyVector(int n,int val){ //val-> size = n; this->mem = new int [size..

C++ 2023.01.10

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

[C++]명품 C++ programming 실습문제 6장 3번 명품 C++ 프로그래밍실습문제/연습문제 /C++ //3-1 #include #include using namespace std; int big(int a ,int b); int big(int a, int b, int max); int main(int argc, const char * argv[]) { int x =big(3,5); int y =big(300,60); int z =big(30,60,50); cout b){ return b; } else return max; } } //3-2 #include #include using namespace std; int big(int a ,int b,int max=100); int main(int ..

C++ 2023.01.10

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

[C++] 명품 C++ 프로그래밍 실습문제 6장 2번 [C++]명품 C++ programming 실습문제 6장 2번 명품 C++ 프로그래밍실습문제/연습문제 /C++ //2-1 #include #include using namespace std; class Person{ double weight; int id; string name; public: Person(){ this->id =1; this->name ="grace"; this->weight = 20.5; } Person(int id,string name){ this->id =id; this->name =name; weight = 20.5; } Person( int id , string name, double weight ){ this->id =id..

C++ 2023.01.07

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

[C++]명품 C++ 프로그래밍 실습문제 openchallenge [C++]명품 C++ 프로그래밍 실습문제 오픈챌린지 명품 C++ 프로그래밍 실습문제/연습문제 /C++ #include #include #include #include using namespace std; class Person{ string name; public: Person(string sen){ name = sen; } string getName(){ return name; } }; class UpAndDownGame{ public: static int getRand(){ srand((unsigned)time(0)); int realnum; realnum = rand()%100; return realnum;//이넘버와 같은 사람이 게..

C++ 2023.01.06