#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include <time.h>

//1. 프로그램 시작 -> 2. 랜덤 초기화 -> 3. 현재 돈 출력
//-> 4. 배팅 -> 5. if(돈 부족 -> 에러 출력 -> 4번 돌아감)
//-> 6. else(슬롯 머신 시작) -> 7. [잭팟 || 보상지금 || 꽝] 
//-> 


void setColor(int color){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),color);
	//ex) setColor(14)
}

int main(){
	system("chcp 949");
	
	srand((unsigned int)time (NULL));
	
	int money = 1000;
	int bet;
	
	char symbo[11]={
		'7', 
		'*',
		'@',
		'#',
		'$',
		'&',
		'%',
		'^',
		'+',
		'-',
		'!'
	};
	
	while(money > 0){
		system("cls");
		
		printf("==========================\n");
		printf(" SLOT MACHINE\n");
		printf("==========================\n");
		
		printf("CURRENT MONEY : %d\n\n", money);
		
		printf("BET MONEY :");
		scanf("%d", &bet);
		
		if(bet <= 0){
			printf("\n INPUT ERROR");
			Sleep(1000);
			continue;
		}
		if(bet > money){
			printf("\n NOT ENOUGH MONEY\n");
			Sleep(1000);
			continue;
		}
		money -= bet;
		
		int s1, s2, s3;
		
		printf("\n SPINNING \n\n");
		
		for(int i=0; i<15; i++){
			s1 = rand()%11;
			s2 = rand()%11;
			s3 = rand()%11;
			
			printf("\r[%c] [%c] [%c]", symbo[s1], symbo[s2], symbo[s3]);
			
			Sleep(100);
		}
		
		printf("\n\n");
		
		if(s1 == s2 && s2 == s3){
			printf("!!JACKPOT!!\n");
			money += bet*11;
			printf("win : %d\n", bet*11);
		}else if(s1 == s2 || s2 == s3 || s1 == s3){
			printf("TWE MATCH");
			money += bet*2;
			printf("win : %d\n", bet*2);
		}else{
			printf("LOSE");
		}
		
		printf("\nPRESS ENTER!");
		getchar();
		getchar();
	}
	system("cls");
	//printf("==========================\n");
	printf(" 거지ㅋ\n");
	//printf("==========================\n");
	return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: