展开全部
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