• Web sitemizin içeriğine ve tüm hizmetlerimize erişim sağlamak için Web sitemize kayıt olmalı ya da giriş yapmalısınız. Web sitemize üye olmak tamamen ücretsizdir.
  • Sohbetokey.com ile canlı okey oynamaya ne dersin? Hem sohbet et, hem mobil okey oyna!
  • Soru mu? Sorun mu? ''Bir Sorum Var?'' sistemimiz aktiftir. Paylaşın beraber çözüm üretelim.
Bu, hızlı yüklenen mobil optimize edilmiş bir AMP sayfadır, gerçek sayfayı yüklemek istiyorsanız bu metni tıklayın.

Hangman (Adam Asmaca) C++

Üyelik Tarihi
7 Ocak 2015
Konular
4,091
Mesajlar
4,274
MFC Puanı
40
#include <iostream>
#include <string>
#include<stdlib.h>
#include<time.h>
#include<conio.h>
using namespace std;
using std::string;

int main()
{
string array[26]={"computer","agnostic","anemi a","bannisters","doormat","sho ulder","percentage","consumpti on","fishmonger","psychologist ","programmer","millipede","he dgehog","tangerine","watermelo n","lumbago","jaundice","const ipated","contagious","dysenter y","devious","boastful","swimt ruck","pullover","thunderstorm ","satellite"};
char array2[7];
char choice,char1;
int i,j,count=0,count1=0,flag=0,si ze=0,count2=0;

srand(time(NULL));

j=rand()%26;

for (i=0;array[j]!='';i++)
size++;

char *array1;

array1=new char[size];

for (i=0;i<size;i++)
array1='X';

cout << "\t\t\t------------------------------------" << endl;
cout << endl;
cout << "\t\t\tWelcome to Furkan's Hangman Game!!!!" << endl;
cout << endl;
cout << "\t\t\t------------------------------------" << endl;
cout << endl;

while (1)
{
flag=0;

cout << "\t\t\tEntered Characters=";
for (i=0;i<count2;i++)
cout << array2 << " ";
cout << endl;

if (count>=0)
cout << "\n\t\t\t ---------------" << endl;
if (count>=1)
cout << "\t\t\t O" << endl;
if (count==2)
cout << "\t\t\t |" << endl;
if (count==3)
cout << "\t\t\t /|" << endl;
if (count==4)
cout << "\t\t\t /|> " << endl;
if (count==5)
{
cout << "\t\t\t /|> " << endl;
cout << "\t\t\t / " << endl;
}

cout << endl;
cout << "\t\t\t-------------------------" << endl;
cout << endl;
cout << "\t\t\t";
for (i=0;i<size;i++)
cout << array1;
cout << endl;
cout << endl;

cout << "\t\t\tplease enter a character=";
cin >> char1;

array2[count2]=char1;
count2++;

system("cls");

for (i=0;i<size;i++)
{
if (char1==array[j])
{
array1=array[j];
count1++;
flag=1;
}
}
if (flag==0)
count++;

if (count1==size)
{
cout << "\t\t\tYou found right Word:" << array[j] << "!!!\n" << endl;
cout << "\t\t\tTebrikleeeeerrrr!!! YOU WON!!!\n" << endl;
cout << "\t\t\tPlay again?(Y or N)=";
cin >> choice;
if (choice=='Y' || choice=='y')
{
size=0;
j=rand()%26;

for (i=0;array[j]!='';i++)
size++;
for (i=0;i<size;i++)
array1='X';
count=0;
count1=0;
}
if (choice=='N' || choice=='n')
break;
}

if (count==6)
{
cout << "\t\t\tRight Word:" << array[j] << "!!!\n" << endl;
cout << "\t\t\tSorry! YOU LOST!!!\n" << endl;
cout << "\t\t\tPlay again?(Y or N)=";
cin >> choice;
if (choice=='Y' || choice=='y')
{
size=0;
j=rand()%26;

for (i=0;array[j]!='';i++)
size++;

for (i=0;i<size;i++)
array1='X';
count=0;
count1=0;
}
if (choice=='N' || choice=='n')
break;
}
}
return 0;
}