/*
#include<stdio.h>
#include<string.h>
#include<windows.h>
#include<math.h>
#include<time.h>
// 1. gotoxy (search : c언어 gotoxy)
// 2. system
// 3. color
// 4. random
void gotoxy(int x,int y) // 가로, 세로
{
COORD pos= {x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
int main()
{
int x, y, n, k;
char input;
gotoxy(3, 3);
printf("----------------------\n");
gotoxy(3, 4);
printf("up and down 게임을 시작합니다!!");
gotoxy(3, 5);
printf("----------------------\n");
gotoxy(3, 6);
printf("게임을 시작하시겠습니까?");
gotoxy(10, 7);
printf("1 : Yes");
gotoxy(10, 8);
printf("2 : No");
k=0;
for(;;){ // 7, 7
if(kbhit()) {
input = getch();
if(k==0){
if(input=='K' || input=='k') {
system("cls");
gotoxy(5, 5);
printf("game을 시작합니다!!!");
Sleep(2000);
system("cls");
break;
}
}
if(input=='W' || input=='w')
{
if(k==1) {
k=0;
}
}
else if(input=='S' || input=='s')
{
if(k==0) {
k=1;
}
}
if(k==0) {
gotoxy(7, 8);
printf(" ");
gotoxy(7, 7);
printf(">");
}
else {
gotoxy(7, 7);
printf(" ");
gotoxy(7, 8);
printf(">");
}
}
}
/*
int map[25][25] = {0};
int i=0, j=0;
srand(time(NULL));
for(;;) {
Sleep(100);
//gotoxy(i, j);
//printf(" ");
i = rand()%20;
j = rand()%20;
gotoxy(i, j);
if(map[i][j]==0) {
printf("+");
map[i][j]++;
}
else if(map[i][j]==1) {
printf("*");
map[i][j]++;
}
else if(map[i][j]==2) {
printf("@");
map[i][j]++;
}
//printf("%d\n", rand()%10000);
}
*/
/*
for(;;) {
Sleep(10);
gotoxy(i, j);
printf("*");
i++;
if(i>10+j) {
j++;
i=j;
system("cls"); // screen clear
}
}*/
// return 0;
//}
// up and down game programming
// 랜덤으로 숫자가 하나 저장됨(사람은 모름)
// 범위는 1~100(0~99 아님)
// 숫자를 입력하면 업인지 다운인지 컴퓨터가 알려줌
// 맞춘 횟수를 출력하는거를 목표로 하기
/*
#include<stdio.h>
#include<string.h>
#include<windows.h>
#include<math.h>
#include<time.h>
#define LEFT 75
#define RIGHT 77
#define UP 72
#define DOWN 80
void gotoxy(int x,int y)
{
COORD pos= {x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
int main()
{
int x,y,n,k;
char input;
gotoxy(49,5);
printf("==================");
gotoxy(49,6);
printf("|UP AND DOWN GAME|");
gotoxy(49,7);
printf("==================");
gotoxy(53,9);
printf("--START--");
gotoxy(52,11);
printf("<선택 하시오>");
gotoxy(53,13);
printf("----------");
gotoxy(52,14);
printf(":");
gotoxy(53,14);
printf("|시작한다|");
gotoxy(53,15);
printf("----------");
gotoxy(52,18);
printf(":");
gotoxy(53,17);
printf("-----------------");
gotoxy(53,18);
printf("I시작하지 않는다|");
gotoxy(53,19);
printf("-----------------");
k=0;
for(;;)
{
if(kbhit())
{
input = getch();
if(k==0)
{
if(input=='E'||input=='e')
{
system("cls");
gotoxy(47,12);
printf("Loading...");
gotoxy(60,12);
printf("Please wait");
gotoxy(59,14);
printf("잠시 기다려주세요 ");
gotoxy(47,14);
printf("로딩중...");
Sleep(3000);
system("cls");
break;
}
}
else
{
if(input=='E'||input=='e')
{
system("cls");
gotoxy(50,12);
printf("게임을 종료합니다.");
gotoxy(50,14);
printf("The game is closing.");
Sleep(3000);
system("cls");
break;
}
}
if(input==UP)
{
if(k==1)
{
k=0;
}
}
else if(input==DOWN)
{
if(k==0)
{
k=1;
}
}
if(k==0)
{
gotoxy(50, 14);
printf(" ");
gotoxy(50, 14);
printf(">>");
}
else
{
gotoxy(50, 18);
printf(" ");
gotoxy(50, 18);
printf(">>");
}
}
}
}
*/