Hello I am new

I am new to the Forum. I'm a good programmer, best in class, not to brag, but I have never actually created a game. I would like to make a hangman game. I've got
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <cstdlib>
#include <iostream>

using namespace std;

int main()
{
   string words[]={cat, dog, mom, dad, grandma, grandpa, everything, elephant} ;
   srand((unsigned)time(0)) ;
   int pickword=rand()%8+1 ;
   switch (pickword)
   {
      case 1:

Well, now I'm stuck. Please help. Thanks.
First, you probably shouldn't add one to your pickword variable. This means its range would be from 1-8, instead of 0-7 which you want (I assume you would use pickword as an index for the array of strings). Next, a (#include <string>) statement would help, since string information is in that header. From here on, I don't want to spoil anything for you, but I would say you should ask the user for input, evaluating that input to see if it is in the word that was picked, and maybe set a limit for how many guesses there are. Good luck!
I think this is what aquamongoose was saying you might want to do...
1
2
int pickword = rand() % 8;
string word = words[pickword];
You might want to put your words in quots too:
 
string words[]={"cat", "dog", "mom", "dad", "grandma", "grandpa", "everything", "elephant"} ;
Topic archived. No new replies allowed.