빙고게임 질문입니다/
게자리
c언어를 배운지3개월 되가는데요 빙고를 주제로 잡고 프로젝트를 하던 도중
1) 1빙고부터 5빙고까지 체크하는부분
2) 입력받은 숫자를 문자(★)로 바꾸는 부분
이 두가지를 실행시키려고하는데 자꾸 오류가나서 조언부탁드립니다.
소스------------------------------------------------
#include stdio.h
#include stdlib.h
#include time.h
#include windows.h
#include conio.h
#define N 25
void textcolor(int color_number); //text color
void print_map(int user1[N], int user2[N]);
int main ()
{
FILE *fp;
srand((unsigned)time(0));
int user1[25],user2[25];
int count=0, count1=0;
int i,j,k,h,l=0, num1,num2;
int g,m,count2=0,count3=0;
char buf;
char *file_name = test.txt;
int str1[6][6],a,b,c=0;
int str2[6][6],d,e,f=0;
system(color F0);
Sleep(500);
Beep(1318,750);
Beep(1318,250);
Beep(1318,250);
Beep(1396,250);
Beep(1318,250);
Beep(1174,250);
Beep(1046,250);
Beep(932,250);
Beep(880,250);
Beep(932,250);
Beep(783,750);
Beep(783,250);
Beep(1046,1000);
fp = fopen(file_name, r);
if(fp == NULL)
{
printf(%s 파일을 열지 못했습니다.\n, file_name);
exit(1);
}
while( (buf=getc(fp)) != EOF )
{
putchar(buf);
}
fclose(fp);
for(i=0;i25;i++)
user1[i]=i;
while(count100)
{
int c1,c2,temp;
c1=rand()%25;
c2=rand()%25;
temp=user1[c1];
user1[c1]=user1[c2];
user1[c2]=temp;
count++;
}
for(j=0;j25;j++)
user2[j]=j;
while(count1100)
{
int c1,c2,temp;
c1=rand()%25;
c2=rand()%25;
temp=user2[c1];
&nbnbsp; user2[c1]=user2[c2];
user2[c2]=temp;
count1++;
}
sleep(700);
system(cls);
for(b=0; b5; b++)
{
for(a=0; a 5; a++)
{
str1[a][b-1]=user1[c];
c++;
}
}
for(d=0; d5; d++)
{
for(e=0; e5; e++)
{
str2[e-1][d]=user2[f];
f++;
}
}
print_map(user1,user2);
for(l=0; l=1000; l++)
{
printf(user1의 숫자를 입력하세요 :);
scanf(%d, &num1);
for(k=0; k=24; k++)
{
if(user1[k] == num1)
{
user1[k] = 99;
}
}
printf(user2의 숫자를 입력하세요 :);
scanf(%d, &num2);
for(h=0; h=24; h++)
{
if(user2[h] == num2)
user2[h] = 99;
}
sleep(500);
system(cls);
print_map(user1,user2);
}
getch();
return 0;
}
void print_map(int user1[N], int user2[N])
{
printf(┏━┳━┳━┳━┳━┓ ┏━┳━┳━┳━┳━┓\n);
printf(┃%2d┃%2d┃%2d┃%2d┃%2d┃ ┃%2d┃%2d┃%2d┃%2d┃%2d┃\n, user1[1],user1[2],user1[3],user1[4],user1[5],user2[1],user2[2],user2[3],user2[4],user2[5]);
printf(┣━╋━╋━╋━╋━┫ ┣━╋━╋━╋━╋━┫\n);
printf(┃%2d┃%2d┃%2d┃%2d┃%2d┃ ┃%2d┃%2d┃%2d┃%2d┃%2d┃\n, user1[6],user1[7],user1[8],user1[9],user1[10], user2[6],user2[7],user2[8],user2[9],user2[10]);
printf(┣━╋━╋━╋━╋━┫ ┣━╋━╋━╋━╋━┫\n);
printf(┃%2d┃%2d┃%2d┃%2d┃%2d┃ ┃%2d┃%2d┃%2d┃%2d┃%2d┃\n, user1[11],user1[12],user1[13],user1[14],user1[15], user2[11],user2[12],user2[13],user2[14],user2[15]);
printf(┣━╋━╋━╋━╋━┫ ┣━╋━╋━╋━╋━┫\n);
printf(┃%2d┃%2d┃%2d┃%2d┃%2d┃ ┃%2d┃%2d┃%2d┃%2d┃%2d┃\n, user1[16],user1[17],user1[18],user1[19],user1[20],user2[16],user2[17],user2[18],user2[19],user2[20]);
printf(┣━╋━╋━╋━╋━┫ ┣━╋━╋━╋━╋━┫\n);
printf(┃%2d┃%2d┃%2d┃%2d┃%2d┃ ┃%2d┃%2d┃%2d┃%2d┃%2d┃\n, user1[21],user1[22],user1[23],user1[24],user1[0],user2[21],user2[22],user2[23],user2[24],user2[0]);
printf(┗━┻━┻━┻━┻━┛ ┗━┻━┻━┻━┻━┛\n);
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2692144 | C언어와 리눅스에 대한 질문입니다. | 싴흐한세여니 | 2025-04-20 |
2692114 | 컨텍스트 스위칭하는데 걸리는 시간 측정.. | YourWay | 2025-04-19 |
2692086 | 간접참조 연산자, 증감연산자 질문이용! (2) | 블랙캣 | 2025-04-19 |
2692056 | 주석좀 달아주세요. 몇개적엇는데 몇개만달아주세요. (2) | DevilsTears | 2025-04-19 |
2691978 | 진수 쉽게 이해하는법... (3) | 지지않는 | 2025-04-18 |
2691949 | getchar() 한 문자를 입력받는 함수 질문 | 채꽃 | 2025-04-18 |
2691919 | 배열 정렬 및 합치기 질문입니다. | 사과 | 2025-04-18 |
2691845 | c언어왕초보 질문이 있습니다........ | 루나 | 2025-04-17 |
2691815 | void add(int num); 함수... (4) | 살랑살랑 | 2025-04-17 |
2691756 | 명령 프롬프트 스크롤바가 없어요 | 두메꽃 | 2025-04-16 |
2691725 | 자료구조에 관련해서 질문이 있어 글을 올립니다. | 누리알찬 | 2025-04-16 |
2691697 | if 문에서 구조체 배열에 저장되있던 문자열 검사하는 법 ? (2) | 민트맛사탕 | 2025-04-16 |
2691678 | C언어 함수 질문이요~!!! | 연보라 | 2025-04-15 |
2691650 | 반복문 | 돋가이 | 2025-04-15 |
2691618 | 링크드리스트 개념 질문이예요 (3) | 맨마루 | 2025-04-15 |
2691592 | 동적할당 이용 배열선언 질문입니다.ㅠㅠ (3) | 허리달 | 2025-04-15 |
2691542 | /=의 용도를 알려주세요 ㅠㅠ! (2) | 아라 | 2025-04-14 |
2691510 | sizeof 연산자 질문입니다 (2) | 종달 | 2025-04-14 |
2691483 | 파일 오픈시 에러 질문드립니다. (2) | 호습다 | 2025-04-14 |
2691450 | [visual c++ 툴]기초 질문 (3) | 해긴 | 2025-04-13 |