1 Replies - 166 Views - Last Post: 07 October 2013 - 04:55 AM Rate Topic: -----

#1 kyaaaaa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 06-October 13

C++ // GUESS A WORD GAME MODIFICATION PROBLEM!

Posted 07 October 2013 - 04:45 AM

can anyone please help me modify my game "guess a word game"
i need a question # 2 and 3.. can anyone help me! please!!!

// "guess_word.txt"
//What_is_apple? fruit edible
//What_is_balls? round basketball
//what_is_human? animal you





#include<iostream>
#include<conio.h>
#include<fstream>
#include<time.h>
using namespace std;
main()
{
srand(time(NULL));



int rand_guess;
rand_guess = rand() % 3 + 1;
char H;
int controller = 1;


ifstream infile;
infile.open("guess_word.txt");

while (!infile.eof()) {

// string output
// infile>>output;
// cout<<output<<endl;
string question;
infile>>question;
string guess;
string answer;
infile>>answer;

string hint;
infile>>hint;

if (rand_guess == controller) {
cout<<"Question is "<<question<<endl;
//cout<<"Answer is "<<answer<<endl;
cout<<"PRESS H FOR HINT(X TO CANCEL IT)"<<endl<<"---->";
cin>>H;
if (H == 'h'||H == 'H')
{cout<<"Hint is "<<hint<<endl;


}
else if (H == 'X'||H == 'x')
cout<<"Enter your MAGIC WORD: ";
{cin>>guess;
if (guess == answer)
{cout<<"correct"<<endl;
system("pause");
return 0;}
else
{cout<<"wrong";}
system("pause");
return 0;
}
if (guess == answer)
{
cout<<"correct";
system("pause");
return 0;}
else
{cout<<"wrong";
system("pause");}
return 0;
}

controller++;


}

system("pause");
return 0;
}

Is This A Good Question/Topic? 0
  • +

Replies To: C++ // GUESS A WORD GAME MODIFICATION PROBLEM!

#2 jimblumberg  Icon User is offline

  • member icon


Reputation: 4002
  • View blog
  • Posts: 12,346
  • Joined: 25-December 09

Re: C++ // GUESS A WORD GAME MODIFICATION PROBLEM!

Posted 07 October 2013 - 04:55 AM

Duplicate topic, Closed.

Jim

This post has been edited by jimblumberg: 07 October 2013 - 04:55 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1