دانلود سورس بازی حدس کلمات با ++C

این پروژه شامل 2 بازی است :
- بازی حدس کلمات : که در واقع با انتخاب یک موضوع کلمه ای تصادفی در ارتباط با آن موضوع انتخاب می شود و تعدادحروف آن کلمه به شما نشا ن داده می شود. شما فرصت دارید بعد از چند انتخاب کلمه را حدس بزنید در غیر اینصورت امتیاز شما به صفر می رسد و شما می بازید.
- بازی 101 : در این بازی به درخواست شما یک عدد تصادفی بین 1 تا 99 به شما اختصاص می یابد.اگر از عدد راضی بودید به کامپیوتر پیشنهاد می دهید خود این بازی را ادامه دهد. راضی بودن مساوی است با نزدیک بودن مجموع اعداد دریافتی شما از کامپیوتر بع عدد 101.اگر راضی نبودید درخواست یک عدد دیگر را نیز می دهید.منتها اگر مجموع از 101 رد شود ، بازی را می بازید.
اصل برنامه را می توانید در پایین صفحه دانلود کنید
اینم سورس کد برنامه که می توانید در هر نسخه ی ویژوال استودیو از آن بهره بگیرید:
/************************************/
/* fig: Shno Game */
/* By: taher shali */
/* www.SourceCodes.ir */
/************************************/
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <ctype.h>
#include <time.h>
#include <string.h>
#include <windows.h>
using namespace std;
int NumbersOfG=0;
int NUMS=0;
//________________________________________________
void printMainMenu()
{
cout<<" ** * * * * * * * * * * * * * * * * * * * * * * * * * * * **"< cout<<" * *"< cout<<" * "< cout<<" *";
for( int tt=1;tt<22;tt++)
cout< cout< for(int tt=1;tt<23;tt++)
cout< cout<<"* * "<
cout<<" * *"< cout<<" ** * * * * * * * * * * * * * * * * * * * * * * * * * * * **"< }
//________________________________________________
void printCredits()
{
system("cls");
int CREDIT_NUMS=50;
char* creditln1=new char[CREDIT_NUMS];
printMainMenu();
creditln1=" Simple Shno Game version:1.0.0 Make by: Taher Shaliabdi you sent All qustions to my E.mails : info@sourcecodes.ir ";
for(int i=0;i {
cout< Sleep(20);
}
cout<<" ";
system("pause");
}
//________________________________________________
bool areEqual(char* string1,char* string2)
{
bool result=true;
if(strlen(string1)==strlen(string2))
{
for(int i=0;i {
if(string1[i]!=string2[i])
{
result=false;
}
}
}
else
{
result=false;
}
return result;
}
//________________________________________________
bool isCharacterOf(char character,char *string)
{
bool ico=false;
for(int i=0;i if(toupper(string[i])==toupper(character))
ico=true;
return ico;
}
//________________________________________________
int *findTarget(char character,char *string)
{
int t=0;
for(int i=0;i if(toupper(string[i])==toupper(character))
t++;
int *a=new int[t];
NUMS=t;
t=0;
for(int i=0;i {
if(toupper(string[i])==toupper(character))
{
a[t]=i;
t++;
}
}
return a;
}
//________________________________________________
void meno(){
cout<<" * * * What do you want to do now? *"< cout<<" * *"< cout<<" * 1.Play Shno Game *"< cout<<" * 2.Play 101 Game *"< cout<<" * 3.About Us *"< cout<<" * Or any other key to quit *"< cout<<" * *"< cout<<" ** * * * * * * * * * * * * * * * * * * * * * * * * * * * **"< cout<<" ";}
//_________________________________________________
void welcome(char ww[10])
{
for(int tt2=47;tt2>25;tt2--)
{
cout<<" ";
for(int tt1=tt2;tt1>0;tt1--)
cout< cout< Sleep(70);
system("cls");
}
Sleep(300);
system("cls");
Sleep(400);
}
//====================================================================================================================
//====================================================================================================================
int main()
{
srand(time(NULL));
char** words=new char*[70];
for(int i=0;i<50;i++)
{
words[i]=new char[70];
}
//----------------------------------------------------------------------------------------------------------------------------------
words[0]="mother_board";words[1]="keyboard";words[2]="mouse";words[3]="monitor";words[4]="modem";
words[5]="peugeot";words[6]="ferrari";words[7]="mclaren";words[8]="mitsubishi";words[9]="jaguar";words[10]="bugatti";words[11]="Lamborghini";words[12]="Chevrolet";words[13]="Audi";words[14]="toyota";words[15]="Viper";words[16]="mercedes-benz";
words[16]="Afghanistan";words[17]="Albania";words[18]="Algeia";words[19]="America";words[20]="Angola";words[21]="Argentina";words[22]="Armenia";words[23]="Australia";words[24]="Azerbaijan";words[25]="Bangladesh";words[26]="Belarus";words[27]="Belgium";words[28]="Benin";words[29]="Bolivia";words[30]="Bosnia_Herzegovina";words[31]="Brazil";words[32]="Britain";words[33]="Bulgaria";words[34]="Cameroon";words[35]="Canada";
words[36]="sheraz";words[37]="rasht";words[38]="oshnaveyeh";words[39]="tehran";words[40]="tabriz";words[41]="boshehr";words[42]="sari";words[43]="gorgan";words[44]="sanandaj";words[45]="mhabad";words[46]="saghez";words[47]="sardasht";
words[48]="c++";words[49]="java";words[50]="asp.net";words[51]="vb.net";words[52]="delphi";words[53]="pascal";words[54]="visual_basic";words[55]="basic";
//----------------------------------------------------------------------------------------------------------------------------------
welcome("www.SourceCodes.ir");
int fails=0;
int ans2;
int rnd;
char ch1;
char word[27];
int save1,save2;
char key1[2]="y";
int key;
char *tahera=new char[40];
int tt1;
int rnd2;
MainMenu:
system("cls");
printMainMenu();
int ans=0;
meno();
cin>>ans;
switch(ans)
{
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
case 1 :
GetAnswer2:
NumbersOfG=0;
srand(time(NULL));
system("cls");
printMainMenu();
cout<<" About:"< cout<<" 1.computer hardwares 2.cars 3.countries 4.city 5.programing languages ";
cin>>ans2;
//________________________________________________________________
switch(ans2)
{
case 1: rnd=rand()%5;break;
case 2: rnd=rand()%12+5;break;
case 3: rnd=rand()%20+16;break;
case 4: rnd=rand()%11+36;break;
case 5: rnd=rand()%7+48;break;
default :cout<<" You have to enter 1 , 2 , 3 , 4 or 5 ";
system("pause");
goto GetAnswer2;
break;
}
//_________________________________________________________________
unsigned int n;
for (n=0; n word[n]='';
fails=strlen(words[rnd])*2-n/2;
while(fails>0)
{
system("cls");
printMainMenu();
if(!(isCharacterOf('-',word)))
{
cout<
Sleep(1000);
rnd2=rand()%2;
if (save2<60)
if(rnd2==1){
Sleep(2000);
system("cls");
printMainMenu();
srand(time(NULL));
rnd=rand()%99+1;
cout<<" New Number = "< save2+=rnd;
cout<<" Sum Computers Number = "< }
Sleep(1000);
rnd2=rand()%4;
if (save2<80)
if(rnd2==1){
Sleep(2000);
system("cls");
printMainMenu();
srand(time(NULL));
rnd=rand()%99+1;
cout<<" New Number = "< save2+=rnd;
cout<<" Sum Computers Number = "< }
Sleep(1000);
rnd2=rand()%6;
if (save2<90)
if(rnd2==1){
Sleep(2000);
system("cls");
printMainMenu();
srand(time(NULL));
rnd=rand()%99+1;
cout<<" New Number = "< save2+=rnd;
cout<<" Sum Computers Number = "< }
Sleep(1000);
rnd2=rand()%2;
if (save2<60)
if(rnd2==1){
Sleep(2000);
system("cls");
printMainMenu();
srand(time(NULL));
rnd=rand()%99+1;
cout<<" New Number = "< save2+=rnd;
cout<<" Sum Computers Number = "< }
if(save2>101){cout<<"Computers Number out of 101 ...you win...";Sleep(3000);goto win;}
system("cls");
printMainMenu();
cout<<" your Sum Number = "< cout<<" Computer Sum Number = "< Sleep(1000);
if(save1>save2){
cout<<" your number > computers number ..........you win........ ";
Sleep(4000);
goto win;
}
goto lose;
win:
system("cls");
tahera=" Congratulations!!! You won the game. ";
cout<<" ";
for( tt1=0;tt1<40;tt1++){
cout< Sleep(100);}
cout<<" ";
system("pause");
printCredits();
goto MainMenu;
system("pause");
goto MainMenu;
lose:
system("cls");
tahera=" GAME OVER ";
cout<<" ";
for( tt1=0;tt1<16;tt1++){
cout< Sleep(100);}
cout<<" ";
system("pause");
printCredits();
goto MainMenu;
break;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
case 3 :
printCredits();
goto MainMenu;
default :
break;
}
welcome("good bay");
return 0;
}
هم اکنون می توانید سورس این پروژه را به صورت رایگان دانلود کنید
حجم فایل :250 KB
آفرین بسسسسسسسسسسسیییییییییییییاااااررررررررررر عااااااااالللللللییییییییییییی
besiarrrrr aliiiii mamnun duste aziz
ببخشید این کد رو توی کدوم بخش ویژوال استودیو وارد کنیم تا قبول کنه ؟ ویژوال استودیو قبولش نمیکنه و میگه باگ داره . راستی ویژوال استودیو 2013 هستش . اگه میشه با ایمیلم در ارتباط باش .
سلام ، کافیه فایل سولوشن را باز کنید و اجرا کنید ، من توی 2008 و 2010 تست کردم هیچ مشکلی نداشت ، اگر مشکلتون حل نشد از خطا ی عکس بگیرید بفرستید به ایمیل سایت تا بررسی کنیم
ممنون بابت مطالب خوب و کاربردی تون مدیر خسته نباشی
به شدت عالی . یکی از تنها سایت هایی بود که کد بدون باگ اجرا شد . نهایت تشکر رو دارم .
Very good