본문내용
r, Bingo user){ // 배열복사함수
for(int i=0; i<5; i++){
for(int j=0; j<5; j++){
copy_user[i][j] = user.get_xy(i,j);
copy_computer[i][j] = computer.get_xy(i,j);
}
}
}
void output(Bingo computer, Bingo user){
system("cls"); // 화면 클리어
copy_board(computer, user);
//배열 출력
cout<
cout<<"===user============================com===================="<
for(int i=0 ; i<5 ; i++)
{
for(int j=0 ; j<5 ; j++)
{
cout<
}
printf(" || ");
for(j=0 ; j<5 ; j++)
{
cout<
}
cout<
}
// 보조판 출력
cout<
cout<<"===user============================com===================="<
for(i=0 ; i<5 ; i++)
{
for(int j=0 ; j<5 ; j++)
{
if(copy_user[i][j] < 0)
{
cout<<" #";
}
else
{
cout<<" .";
}
}
cout<<" || ";
for(j=0 ; j<5 ; j++)
{
if(copy_computer[i][j] < 0)
{
cout<<" #";
}
else
{
cout<<" .";
}
}
cout<
}
cout<
}
};
void main()
{
system("mode con : lines = 25 cols=80");
int num;
int re=1;
int ch;
srand((int)time(NULL));
Bingo user;
Bingo computer;
BingoGame bingogame;
Input_user input_user;
Print print(computer, user);
while(re)
{ ///////////////////////////출력///////////////////////////////
print.output(computer, user);
///////////////////////////user 입력//////////////////////////
num = input_user.user_input();
///////////////////////////선택후계산/////////////////////////
bingogame.find(computer, user, num);
///////////////////////////출력///////////////////////////////
print.output(computer, user);
///////////////////////////이겼는지검사///////////////////////
re = bingogame.win(computer, user);
if(re == 0)
break;
///////////////////////////출력///////////////////////////////
print.output(computer, user);
///////////////////////////가중치최고값계산///////////////////
num = bingogame.com_max(computer);
///////////////////////////선택후계산/////////////////////////
bingogame.find(computer,user,num);
///////////////////////////출력///////////////////////////////
print.output(computer, user);
///////////////////////////이겼는지검사///////////////////////
re = bingogame.win(computer, user);
}
fflush(stdin);
// 입력대기를 사용하기위해 메모리를 비워준다.(cout은 메모리에 남아있기때문에)
//fflush를 쓰지 않았을경우 : 컴퓨터에 선택에 대해 키의 입력을 기다리는 대기 모드가 없이 지나간다.
while((ch = getchar()) != '\n'){ //입력대기
}
}
for(int i=0; i<5; i++){
for(int j=0; j<5; j++){
copy_user[i][j] = user.get_xy(i,j);
copy_computer[i][j] = computer.get_xy(i,j);
}
}
}
void output(Bingo computer, Bingo user){
system("cls"); // 화면 클리어
copy_board(computer, user);
//배열 출력
cout<
{
for(int j=0 ; j<5 ; j++)
{
cout<
printf(" || ");
for(j=0 ; j<5 ; j++)
{
cout<
cout<
// 보조판 출력
cout<
{
for(int j=0 ; j<5 ; j++)
{
if(copy_user[i][j] < 0)
{
cout<<" #";
}
else
{
cout<<" .";
}
}
cout<<" || ";
for(j=0 ; j<5 ; j++)
{
if(copy_computer[i][j] < 0)
{
cout<<" #";
}
else
{
cout<<" .";
}
}
cout<
cout<
};
void main()
{
system("mode con : lines = 25 cols=80");
int num;
int re=1;
int ch;
srand((int)time(NULL));
Bingo user;
Bingo computer;
BingoGame bingogame;
Input_user input_user;
Print print(computer, user);
while(re)
{ ///////////////////////////출력///////////////////////////////
print.output(computer, user);
///////////////////////////user 입력//////////////////////////
num = input_user.user_input();
///////////////////////////선택후계산/////////////////////////
bingogame.find(computer, user, num);
///////////////////////////출력///////////////////////////////
print.output(computer, user);
///////////////////////////이겼는지검사///////////////////////
re = bingogame.win(computer, user);
if(re == 0)
break;
///////////////////////////출력///////////////////////////////
print.output(computer, user);
///////////////////////////가중치최고값계산///////////////////
num = bingogame.com_max(computer);
///////////////////////////선택후계산/////////////////////////
bingogame.find(computer,user,num);
///////////////////////////출력///////////////////////////////
print.output(computer, user);
///////////////////////////이겼는지검사///////////////////////
re = bingogame.win(computer, user);
}
fflush(stdin);
// 입력대기를 사용하기위해 메모리를 비워준다.(cout은 메모리에 남아있기때문에)
//fflush를 쓰지 않았을경우 : 컴퓨터에 선택에 대해 키의 입력을 기다리는 대기 모드가 없이 지나간다.
while((ch = getchar()) != '\n'){ //입력대기
}
}
소개글