본문 바로가기

my_lesson/_C++14

C++ - Array_For_BaseballGame Ver.1.0 Mission : Let's make a Baseball Game Random input : 3 numbers between 1 to 9 without duplication. It is a game to find the hidden numbers in the form * * *. Enter three numbers until user find them. If the numbers provided at random are 7, 3, 8 and user enterd numbers are 1, 2, and 4. Outputs 'OUT' because there is no matching number. If the user enters 7,5,or 9, '1 STRIKE 0 BALL' is ouput becau.. 2019. 4. 5.
C++ - Array_For_LottoGenerator 1.1 CPP - Array_For_LottoGenerator #include #include #include using namespace std; #define LOTTO 45 typedef enum { FORTH = 3, THIRD, SECOND, FIRST }GRADE; static const char *grade[] = {NULL,NULL,NULL, "ForthGrade", "ThirdGrade", "SecondGrade", "FirstGrade" }; int main() { srand((unsigned int)time(0)); int iLotto[LOTTO] = {}; int iuInput, iaInput; int iuSort[6]={},iaSort[6] = {}; cout iuInput; iuInpu.. 2019. 4. 5.
CPP - Array _ For _ LottoGenerator 1.0 CPP - Array _ For _ LottoGenerator 1.0 // Create a game Lotto #include #include #include using namespace std; #define LOTTO 45 int main() { srand((unsigned int)time(0)); int iLotto[LOTTO] = {}; for (int i = 0; i 2019. 4. 4.
CPP - Repeat While, RackPaperScissors_Game CPP - Repeat While, RackPaperScissors_Game // Make a RockPaperScissorsGame using a Repeat while statement. #include #include using namespace std; #define MACROSTR(k) typedef enum SRP { SRP_S = 1, SRP_R, SRP_P, SRP_END }; static const char *srpStr[] = { "Scissors", "Rock", "Paper" }; int main() { int iSRP, aiSRP; SRP srp; srand((unsigned int)time(0)); cout 4) { cout 2019. 4. 3.
CPP - Condition If , Switch CPP - Condition If , Switch // Condition if , switch, enum, while #include #include #include #include using namespace std; enum UPGRADE{UPGRADE_1 = 1, UPGRADE_2, UPGRADE_3, UPGRADE_4, UPGRADE_5, UPGRADE_6, UPGRADE_7, UPGRADE_8, UPGRADE_9, UPGRADE_10, UPGRADE_11, UPGRADE_12, UPGRADE_13, UPGRADE_14, UPGRADE_15}; int main() { int iBuff; char cInput1, cInput2; const int iAttack = 0x00000001; const i.. 2019. 4. 3.
CPP - Operator CPP - Operator // What is there a operator #include #include using namespace std; int main() { int iInput1, iInput2; double dInput1, dInput2; // 사칙연산 // +,-,*,ㅗ,% // 연산의 우선순위는 () */ +- 관계연산 논리연산 대입연산(=) // 두개의 실수를 입력을 받아서 사칙연산을 실행해보자 cout dInput1 >> iInput1 >> iInput2; cout 2019. 4. 3.