KULLANICI ADI : ŞİFRE Şifremi Unuttum*

Anasayfa İLLEG4L BANK KREDİ SATIN AL İLLEG4LİZM RAP Sub Domain Bulucu Arama Yap Yeni Konular Bugünki Konular

Konuyu Oyla:
  • Derecelendirme: 1/5 - 1 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Iskambil Kartlariyla Oynanan 21 Oyununun Kodlari
Konu : Iskambil Kartlariyla Oynanan 21 Oyununun Kodlari - 25.02.2015, 01:52
Mesaj: #1
Kod:
//02.10.08
//This program is a card game 21. The directions is displayed in the program.

// by mertimiks

#include<iostream>
#include<iomanip>
#include<ctime>
#include<cstdlib>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

void ask();
void game();
void main()

{

cout<<"This is game 21. Your opponent is computer. The rules are simple"<<endl;
cout<<"If you want to recieve a new card press y, if you do not press n."<<endl;
cout<<"You can recieve 5 cards at most. After you recieve 5 cards the"<<endl;
cout<<"game will finish. At the end whose sum of numbers are closest the"<<endl;
cout<<"21, and their sum is less than 21, will thread as a winner. Computer"<<endl;
cout<<"stops receiving the card till you stop receiving.\n"<<endl;

game();
}

void game()

{

double x1, x2, x3, x4, x5;
double y1, y2, y3, y4, y5;
double human_total;
double computer_total;
char continue_answer1, continue_answer2, continue_answer3, continue_answer4;

x1=1+rand()%11;
cout<<"Your first number is "<<x1<<endl;

y1=1+rand()%11;

cout<<"Do you want to continue y or n. \n";
cin>>continue_answer1;

if ( continue_answer1=='y' )
{
x2=1+rand()%11;
cout<<"Your second number is "<<x2<<endl;
if ( x1+x2 > 21 )
{
cout<<"The winner is computer. hehe!! \n";
ask();
}
y2=1+rand()%11;
cout<<"Do you want to continue y or n. \n";
cin>>continue_answer2;

if (continue_answer2=='y')
{
x3=1+rand()%11;
cout<<"Your third number is "<<x3<<endl;
if ( x1+x2+x3 > 21)
{
cout<<"The winner is computer. hehe!! \n";
ask();
}
y3=1+rand()%11;
cout<<"Do you want to continue y or n. \n";
cin>>continue_answer3;

if (continue_answer3=='y')
{
x4=1+rand()%11;
cout<<"Your fourth number is "<<x4<<endl;
if ( x1+x2+x3+x4 > 21 )
{
cout<<"The winner is computer. hehe!! \n";
ask();
}
y4=1+rand()%11;
cout<<"Do you want to continue y or n. \n";
cin>>continue_answer4;

if (continue_answer4=='y')
{
x5=1+rand()%11;
cout<<"Your fifth number is "<<x5<<endl;
if ( x1+x2+x3+x4+x5 > 21 )
{
cout<<"The winner is computer. hehe!! \n";
ask();
}
y5=1+rand()%11;
cout<<"That's it you can not have more cards anymore . \n";
cout<<"The result is....\n";
human_total=x1+x2+x3+x4+x5;
computer_total=y1+y2+y3+y4+y5;

cout<<"Computer total is "<<computer_total<<endl;
if ( (human_total>computer_total) && human_total<=21 && computer_total<=21 )
cout<<"The winner is you. \n";
else if ( computer_total>human_total && human_total<=21 && computer_total<=21 )
cout<<"The winner is computer. hehe!! \n";
else if ( computer_total==human_total && human_total<=21 && computer_total<=21 )
cout<<"The game ends in a draw. \n";
else if ( human_total>21 && computer_total<=21 )
cout<<"The winner is computer. hehe!! \n";
else if ( computer_total>21 && human_total<=21 )
cout<<"The winner is you. \n";
else if ( computer_total>21 && human_total>21 )
cout<<"The game ends in a draw. \n";
}

else if ( continue_answer4=='n' )
{
human_total=x1+x2+x3+x4;
computer_total=y1+y2+y3+y4;
cout<<"Computer total is "<<computer_total<<endl;
if ( (human_total>computer_total) && human_total<=21 && computer_total<=21 )
cout<<"The winner is you. \n";
else if ( computer_total>human_total && human_total<=21 && computer_total<=21 )
cout<<"The winner is computer. hehe!! \n";
else if ( computer_total==human_total && human_total<=21 && computer_total<=21 )
cout<<"The game ends in a draw. \n";
else if ( human_total>21 && computer_total<=21 )
cout<<"The winner is computer. hehe!! \n";
else if ( computer_total>21 && human_total<=21 )
cout<<"The winner is you. \n";
else if ( computer_total>21 && human_total>21 )
cout<<"The game ends in a draw. \n";
}
}
else if ( continue_answer3=='n' )
{
human_total=x1+x2+x3;
computer_total=y1+y2+y3;
cout<<"Computer total is "<<computer_total<<endl;
if ( (human_total>computer_total) && human_total<=21 && computer_total<=21 )
cout<<"The winner is you. \n";
else if ( computer_total>human_total && human_total<=21 && computer_total<=21 )
cout<<"The winner is computer. hehe!! \n";
else if ( computer_total==human_total && human_total<=21 && computer_total<=21 )
cout<<"The game ends in a draw. \n";
else if ( human_total>21 && computer_total<=21 )
cout<<"The winner is computer. hehe!! \n";
else if ( computer_total>21 && human_total<=21 )
cout<<"The winner is you. \n";
else if ( computer_total>21 && human_total>21 )
cout<<"The game ends in a draw. \n";
}
}
else if ( continue_answer2=='n' )
{
human_total=x1+x2;
computer_total=y1+y2;
cout<<"Computer total is "<<computer_total<<endl;
if ( (human_total>computer_total) && human_total<=21 && computer_total<=21 )
cout<<"The winner is you. \n";
else if ( computer_total>human_total && human_total<=21 && computer_total<=21 )
cout<<"The winner is computer. hehe!! \n";
else if ( computer_total==human_total && human_total<=21 && computer_total<=21 )
cout<<"The game ends in a draw. \n";
else if ( human_total>21 && computer_total<=21 )
cout<<"The winner is computer. hehe!! \n";
else if ( computer_total>21 && human_total<=21 )
cout<<"The winner is you. \n";
else if ( computer_total>21 && human_total>21 )
cout<<"The game ends in a draw. \n";
}
}
else if ( continue_answer1=='n' )
{
human_total=x1;
computer_total=y1;
cout<<"Computer total is "<<computer_total<<endl;
if ( human_total>computer_total )
cout<<"The winner is you. \n";
else if ( computer_total>human_total )
cout<<"The winner is computer. hehe!! \n";
else if ( computer_total==human_total )
cout<<"The game ends in a draw. \n";
}

ask();

}


void ask()

{
char last_question;

cout<<"Do you want to play again y or n. \n";
cin>>last_question;

if ( last_question=='n' )
exit(EXIT_FAILURE);
else if ( last_question=='y' )
game();

}

WWW Alıntı ile Cevapla


Hızlı Menü:


Konuyu Okuyanlar: 1 Ziyaretçi
hd porno antalya escort türk ifşa porno izle türk ifşa porno samsun escort izmir escort ataşehir escort türk ifşa hd porno