c++编写手机小游戏代码_C++小游戏代码

展开全部

http://www.pudn.com/downloads97/sourcecode/others/detail399517.html

#include //Standard input/output

#include //String manipulation

#include //Character manipulation and testing

#include //File stream

#include //Used for random function

#include //Used for better random number

#include"draw.h" //run the draw.h file

using namespace std;

//Function declerations

void instruction(int& choice); //Give instructions and gets choice

void usergame(int i); //Plays 2nd user game

void compgame(int i); //Plays against computer

//Tests current letter and raplaces starred word

void test(string word,char letter,int& numwrong,string& temp,int i);

//Checks current letter and adds it to letters chosen output if not entered already

void lchosen(char letter,string& letterchosen,int& check,int& chosencounter,int i);

void rnd(string& word,int i); //Gets random word from file

void drawman(int numguess,int numwrong,int i); //Draws hangman

inline istream& Flush(istream& stream); //Flushses cin stream

//Start of main

int main()

{

int i=0; //Counter variable for loops

int exit=0; //Main loop exit variable

int choice; //users input choice for type of game or to exit

//Main control loop

do{ //while exit!32313133353236313431303231363533e59b9ee7ad9431333236613466=1

system("cls"); //执行系统命令清屏

instruction(choice);//Give instructions

switch(choice)

{

case 1:

usergame(i);//Calls user game

break;

case 2:

compgame(i);//Calls computer game

break;

case 3:

cout<

exit=1;

break;

default:

cerr<

}

}while(exit!=1);

//End main loop

system("pause"); //执行系统命令:暂停

return 0;

}

//End main

void instruction(int& choice

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值