반응형

** #include "myfunc.h" **

 

 

#include <conio.h>
#include <windows.h>

#define LEFT 75
#define RIGHT 77
#define UP 72
#define DOWN 80
#define SPACE 32


#define BLACK 0
#define BLUE 1
#define GREEN 2
#define IVORY 3
#define RED 4
#define PURPLE 5
#define YELLOW 6
#define WHITE 7
#define GRAY 8
#define SKYBLUE 9
#define YELLOWGREEN 10
#define WHITEIVORY 11
#define PINK 12
#define WHITEPURPLE 13
#define WHITEYELLOW 14
#define BOLDWHITE 15

#define BOARD_SIZE 5

void setColor(int background, int foreground)
{
 SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (background << 4) | foreground);
}

 

// 헤더함수

 

=====================================================================

 

 

#include "stdafx.h"
#include <stdio.h>
#include "myfunc.h"
#include <random>
using namespace std;

#define MAX 20

int main()
{
 // 랜덤수 출력 함수
 random_device rn;
 mt19937_64 rnd(rn());
 uniform_int_distribution<int> range(1, MAX); // 1부터 MAX사이에서 출력한다.
 int board[20];
 int count = 0;
 int bat = 0;
 int jackpot = range(rn);
 int money = 1000000;
 int batmoney = 0;
 boolean state = 1;

 for (int i = 0; i < MAX; i++) {
  board[i] = i + 1;
 }
 while (1) {
  system("cls");
  printf("\n");
  setColor(BLACK, YELLOW);
  printf("                                                                 GOLD : %d", money);
  setColor(BLACK, RED);
  printf("                         R   O   U   L   E   T   T   E                      \n\n");


  for (int i = 0; i < MAX; i++) {
   if (i % 2 == 0) setColor(RED, WHITE);
   else setColor(BLACK, WHITE);
   printf(" %02d ", board[i]);
  }

  printf(" \n");

  count++;
  if (count >= 20) count = 0;
  for (int i = 0; i < count; i++) {
   printf("    ");
  }
  printf(" ●");

 

  printf("\n\n\n\n얼마를 배팅하시겠습니까 ?  : ");
  scanf_s("%d", &batmoney); 
  printf("\n\n\n어떤 색에 배팅하시겠습니까 ? (1번 : 빨강색, 2번 : 검정색) : ");
  scanf_s("%d", &bat);

  if (bat == jackpot%2){
   printf("축하합니다.");
   money = money + batmoney;
  }
  else {
   printf("꽝.");
   money = money - batmoney;
  }
  Sleep(50);
 }

 return 0;
}

 

반응형

+ Recent posts