Dasturlash ii” fanidan kurs ishi mavzu: Test dasturini yaratish


Download 1.46 Mb.
bet12/12
Sana16.06.2023
Hajmi1.46 Mb.
#1494507
1   ...   4   5   6   7   8   9   10   11   12
Bog'liq
KURS ISHI- Asilbek Kamolov

if (c < 0 or c > 9)
{
cout << " X X > XATOLIK! [1dan 9gacha raqam kiriting] < X X\n";
goto kiritish;
}
else if (c == 0)
{
cout << "\n > > ^ O‘yin yopildi ^ < <\n";
return 0;
}
if (k == 0)
{
qayta[k] = c;
}
else if (k > 0)
for (int i = 0; i < k; i++)
if (qayta[i] != c)
qayta[k] = c;
else
{
cout << "\nx x x x x x x x x x x x";
cout << "\n Boshqa katak tanlang!\n";
goto kiritish;
}
k++; //keyingi navbat uchun


if (k % 2 == 1)
s[c - 1] = x;
else
s[c - 1] = o;
tic_show (s);


if (k > 8)
{
if (check (s) == 1)
{
who++;
tic_begin ();
tic_cin ();
}
else
{
cout << "\n = = = = = = = = =\n";
cout << " = D U R R A N G =\n";
cout << " = = = = = = = = =\n";
who++;
tic_begin ();
tic_cin ();
}
}
else if (check (s) == 0)
goto kiritish;
else
{
who++;
tic_begin ();
tic_cin ();
}
return 0;
}

void plus_start (int which)


{
system ("CLS");
switch (which)
{
case 1:
cout << "\n\n\t| To‘g‘ri qo‘shish |\n";
break;
case 2:
cout << "\n\n\t| To‘g‘ri Ko‘paytirish |\n";
break;
case 3:
cout << "\n\n\t| Tic-Tac-Toe |\n";
break;
}
plus_game:
cout << "\n|> 1 => BOSHLASH |> 0 => Chiqish \n";
cout << ">>> Tanlovni kiriting (1 yoki 0)>>> ";

short start = 0;


cin >> start;
switch (which)
{
case 1:
case 2:
switch (start)
{
case 0:
g_over ();
break;
case 1:
{
cout <<
"\n< < < -1 ni kiritib o‘yinni yakunlashingiz mumkin > > >\n";
plus_play (which);
break;
}


default:
{
cout << "\n _X_X_X_X_ X A T O L I K _X_X_X_X_\n";
goto plus_game;
}
}
break;


case 3:
{
switch (start)
{
case 0:
g_over ();
break;
case 1:
{
tic_begin ();
tic_cin ();
}
break;


default:
{
cout << "\n _X_X_X_X_ X A T O L I K _X_X_X_X_\n";
goto plus_game;
}
}
}
break;
}
}

int game ()


{
cout << "\n\t _________________________";
cout << "\n\t| 1. To‘g‘ri Qo‘shish |";
cout << "\n\t| 2. To‘g‘ri Ko‘paytirish |";
cout << "\n\t| 3. Tic-Tac-Toe |";
cout << "\n\t| 4. O‘yin haqida |";
cout << "\n\t| 0 => O‘yinni yopish |";
cout << "\n\t ************************* ";

short g;


cout << "\n > > Raqam bilan o‘yinni tanlang > > ";
cin >> g;


return g;
}

int main ()


{
cout << "\n\t| O‘yinimizga xush kelibsiz |\n";

game_start:


cout << "\n\t> > Sizda " << score << " XP bor < <\n";
cout << "\n\t> > O‘yinlar ro‘yxati < <";
int choise = game ();
switch (choise)
{
case 0:
{
g_over ();
return 0;
break;
}
case 1:
plus_start (1);
break;
case 2:
plus_start (2);
break;
case 3:
{
if (score >= 150)
plus_start (3);
else
{
system ("CLS");
cout << "\n xx>> Siz hali 150 XP yig‘madingiz <;
}
}
break;
case 4:
info ();
break;


default:
{
system ("CLS");
cout << "\n _X_X_X_X_ X A T O L I K _X_X_X_X_\n";
goto game_start;
}
}
goto game_start;
return 0;

Download 1.46 Mb.

Do'stlaringiz bilan baham:
1   ...   4   5   6   7   8   9   10   11   12




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling