Tech Blog/C and C++
C언어 - switch case break 가위바위보 랜덤
EXPRESSIONS HAVE POWER
2021. 6. 8. 22:25
C언어 - switch case break 가위바위보 랜덤
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main (void){
srand(time(NULL));
int i = rand() % 3;
switch (i)
{
case 0: printf("가위\n"); break;
case 1: printf("바위\n"); break;
case 2: printf("보\n"); break;
default: printf("몰라요\n"); break;
}
return 0;
}
switch case 그리고 break