Thread: Help

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    31

    Exclamation Help

    Hello,
    I'm working on a hangman program, and I'm having trouble writing a code that chooses a random everytime it is played...
    Here's the code I started on...

    Code:
    	string s;
    	int count=0;
    	string filename = "words.txt";
    	ifstream input;
    	input.open(filename.c_str());
    	    if (input.fail())
        {   cout << "could not open " << filename << " for reading" << endl;
            exit(1);
        }
    	while (getline(input, s))
    	{
    		count++;
    	}
    Thanks for the help.
    Last edited by Aakash Datt; 04-26-2003 at 02:30 AM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Using my vast telepathic powers, I've located the problem. Using yours, discern the answer. If you don't have any, then you'll have to post some code.

    Woah... Deja Vu!

    On a side note, if you had actually read the FAQ, you wouldn't have needed to post.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    31

    Help?

    Andy advice on what I should do?

Popular pages Recent additions subscribe to a feed