언어 썸네일형 리스트형 변수~문자열 #한줄 주석문 ''' 여러줄 주석문 ''' #문자열 단따옴표, 쌍따옴표 지원 ㅣ js와동일 print('hello') print("hello") #변수 : 타입 지정이 없음 . var 없음 a=10 print(a) #숫자형 데이타 #정수 a=123 print(a) a=1.23 print(a) a=1.23e-2 print(a) #8진수 a=0o77 print(a) #16진수 a=0xff print(a) #복소수 #실수부 + 허수부 i a=1+2j #실수부 출력 print(a.real) #허수부 출력 print(a.imag) #사칙연산 a=3 b=5 print(a+b) #문자열 데이타 print('python programming') print("python programming") print("""pyth.. 더보기 up & down 게임 만들기 ! #include #include #include #include using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ class Player{ private : string name[2]; int idx; public : Player(){name[0]="옥돌이"; name[1]="돌딸기"; idx=-1;} string getName(){ idx++; if(idx==2){ idx=0; return name[idx]; } else{ return name[idx]; } } }; class UpAndDownGame{ private: static in.. 더보기 끝말잇기 게임 만들기 ! class Player(){ private : int number; int idx; string *name; public : Player(int n); ~Player() {delete [] name;} string getName(); }; Player :: Player(int n){ number =n; idx=-1; name=new string[number]; fflush(stdin); for(int i=0; i 더보기 겜블링 게임 만들기 ! class Player{ private : string name[2]; int i; public: Player() {i=0;} void setName(string name){name[i]=name; i++;} string getName (){ if(i>=2){ i=0; return name[i]; } else{ return name[i]; } i++; } }; class GamblingGame{ private : int num[3]; public : GamblingGame() {srand(unsigned) tme (0));} void Game(); }; void GamblingGame :: Game(){ cout 더보기 4단원 예제문제 #include using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ //원의 개수를 입력받고 circle 배열을 동적 생성하라 // 반지름의 값을 입력 받아 circle 배열에 저장하고 // 면적이 100에서 200사이인 원의 개수를 출력하라 class Circle{ int radius; public: Circle(); ~Circle(){ } void setRadius(int r){ radius=r; } double getArea(){ return 3.14*radius*radius; } }; Circle :: Circle(){ radius=.. 더보기 5단원 실습문제 (참조, 복사생성자 ) //6번 #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; class MyIntStack { int *p; int size; int tos; public : MyIntStack(); MyIntStack(int size){ tos=-1; p = new int[size]; this->size = size; } MyIntStack(MyIntStack& s); ~MyIntStack(){ delete [] p; } bool push(int n); bool pop(int &n); }; bool MyIntStack::p.. 더보기 복사생성자 #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; class Person{ char *name; int id; public : Person(int id,char*name); Person(Person& person); ~Person(); void changeName(char *name); void show(){cout id=person.id; int len=strlen(person.name); this->name=new char[len+1]; strcpy(this->name,person.name); coutn.. 더보기 함수와 참조 #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; char& find(char s[], int index){ return s[index]; } int main(int argc, char** argv) { char name[]="Mike"; cout 더보기 이전 1 ··· 3 4 5 6 7 다음