본문 바로가기
반응형

C언어17

[c언어] 로또번호 생성기 #include #include #include void main() { srand((unsigned)time(NULL)); int Lotto[50] = { 0 }; for (int i = 0; i < 50; i++) { Lotto[i] = i + 1; } while (true) { char Set = 0; printf("로또번호를 뽑으시겠습니까? Y/N:"); scanf_s("%c", &Set); getchar(); if (Set == 'y') { for (int i = 0; i < 50; i++) //50번 섞기 { int randNum1 = rand() % 51; int randNum2 = rand() % 51; int temp; temp = Lotto[randNum1]; Lotto[randNum1.. 2020. 4. 2.
[c언어]Matrix(매트릭스)게임 #include #include #include #include #include // kbhit(), getch() #pragma warning (disable : 4996) //방향키의 아스키 코드값 #define MAX 1024 #define LEFT 75 #define RIGHT 77 #define UP 72 #define DOWN 80 #define ESC 27 void gotoxy(int x, int y) { COORD Pos = { x - 1, y - 1 }; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos); } struct Signal { bool exist; // 신호의 존재 여부 char ch; // 출력할 문자 int x,.. 2020. 4. 2.
[C언어] 학생 성적 프로그램 (+반평균) #include #include //system함수사용 // 무한루프 void main() { // //1.입력 999.프로그램 종료 //국어점수 : //예외처리 //n번 학생 총점 : 평균 : (매번나오게) //2~7명 사이로 입력받기 //999입력하면 while문 빠져나오면 //결과 -> 학생수 : , 반평균 : int num = 0; int total = 0; while (true) { int a = 0; int kor, eng, math = 0; int sum; int avg; system("cls"); printf("\n"); printf("1.입력 999.프로그램 종료 : "); scanf_s("%d", &a); getchar(); if (a == 1) { printf("국어점수 :"); sc.. 2020. 4. 2.
[C언어] 가위 바위 보 게임 #include #include //랜덤값을 얻기위해 필요한 헤더파일 #include //가위바위보 게임 void main() { int score = 0; int m_score = 0; int s_score = 0; int total = 0; int money = 500; while (true) { if (money 3) { if (a_Usersel == 99) break;//게임종료 printf("숫자를 잘못 입력하셨습니다.\n"); printf("Enter를 누르면 게임을 계속합니다..."); getchar(); system("cls"); continue; }//if (a_Usersel 3) else { total++; int game = (rand() % 3) + .. 2020. 4. 2.
반응형