srand

    C언어 프로젝트 4 : 비밀번호 마스터

    C언어 프로젝트 4 : 비밀번호 마스터

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 #include #include // 함수 선언 int getRandomNumber(int level); void showQuestion(int level, int num1, int num2); void success(); void fail(); int main(void) { // 문이 5개가 있고, 각 문마다 점점 어려운 수식 퀴즈가 출제 (랜..

    C언어 프로젝트 3 : Up and Down

    C언어 프로젝트 3 : Up and Down

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 #include #include #include // Up and Down int main(void) { srand(time(NULL)); int num = rand() % 100 + 1; // 1 ~ 100 사이의 숫자 printf("숫자 : %d\n", num); int answer = 0; int chance = 5; while (chance > 0) { printf("남은 기회 %d번\n", chance--); printf("숫자를 맞혀보세요 : %d\n", answer); scanf_s("%d", &answer..