본문내용
computer, 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(int j=0 ; j<5 ; j++)
{
cout<
}
cout<
}
// 보조판출력
cout<
cout<<"===user============================com===================="<
for(int i=0 ; i<5 ; i++)
{
for(int j=0 ; j<5 ; j++)
{
if(copy_user[i][j] < 0)
{
cout<<" #";
}
else
{
cout<<" .";
}
}
cout<<" || ";
for(int 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(int 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(int 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'){ //입력대기
}
}
소개글