ویرگول
ورودثبت نام
حدیث مسیبی
حدیث مسیبی
خواندن ۱ دقیقه·۴ سال پیش

کد بازی دوز ++c

#include<iostream.h>

#include<conio.h>

#include<stdlib.h>

int main()

{

system("color 7c");

int barandeh=0;

int duz[9]={0};

int duz1[4]={0};

int duz2[4]={0};

int nobat=1;

int a;

gotoxy(1,2);

cout<<"WELLCOME TO DUZ:\n";

gotoxy(2,2);

cout<<" 1 | 2 | 3 \n";

gotoxy(2,3);

cout<<"-----|-----|-----\n";

gotoxy(2,4);

cout<<" 4 | 5 | 6 \n";

gotoxy(2,5);

cout<<"-----|-----|-----\n";

gotoxy(2,6);

cout<<" 7 | 8 | 9 \n";

while(barandeh==0)

{

switch(nobat)

{

case 1:

gotoxy(40,8);

cout<<"Please enter a number between 1 to 9 for Player1:";

gotoxy(40,10);

cout<<" ";

gotoxy(40,10);

cin>>a;

if(a<1 || a>9)

{

gotoxy(2,10);

cout<<"The correct number is between 1 to 9";

getch();

gotoxy(2,10);

cout<<" ";

continue;

}

if(duz[a]==1)

{

cout<<"The number is duplicate. Please enter another number...";

nobat=1;

continue;

}

if(a==1)

{

gotoxy(4,2);

cout<<"*";

}

if(a==2)

{

gotoxy(10,2);

cout<<"*";

}

if(a==3)

{

gotoxy(16,2);

cout<<"*";

}

if(a==4)

{

gotoxy(4,4);

cout<<"*";

}

if(a==5)

{

gotoxy(10,4);

cout<<"*";

}

if(a==6)

{

gotoxy(16,4);

cout<<"*";

}

if(a==7)

{

gotoxy(4,6);

cout<<"*";

}

if(a==8)

{

gotoxy(10,6);

cout<<"*";

}

if(a==9)

{

gotoxy(16,6);

cout<<"*";

}

case 2:

gotoxy(40,11);

cout<<"Please enter a number between 1 to 9 for Player2:";

gotoxy(40,12);

cout<<" ";

gotoxy(40,12);

cin>>a;

if(a<1 || a>9)

{

gotoxy(2,13);

cout<<"The correct number is between 1 to 9";

getch();

gotoxy(2,13);

cout<<" ";

continue;

}

if(duz[a]==1)

{

cout<<"The number is duplicate. Please enter another number...";

nobat=2;

continue;

}

if(a==1)

{

gotoxy(4,2);

cout<<"o";

}

if(a==2)

{

gotoxy(10,2);

cout<<"o";

}

if(a==3)

{

gotoxy(16,2);

cout<<"o";

}

if(a==4)

{

gotoxy(4,4);

cout<<"o";

}

if(a==5)

{

gotoxy(10,4);

cout<<"o";

}

if(a==6)

{

gotoxy(16,4);

cout<<"o";

}

if(a==7)

{

gotoxy(4,6);

cout<<"o";

}

if(a==8)

{

gotoxy(10,6);

cout<<"o";

}

if(a==9)

{

gotoxy(16,6);

cout<<"o";

}

}

}

getch();

}

برنامه نویسیبازی دوزcکدنویسیسورس کد
شاید از این پست‌ها خوشتان بیاید