Image

Imageicstepec wrote in Imagecpp

Basic Stuff

I'm not positive if I'm going about it the right way.. but..



void getword()
{


srand ((unsigned)time(0));

char word[15][6] = { "abcde", "munch", "dwarf", "lunch", "float", "fiver", "along", "right", "price", "cream", "words", "niner", "eight", "parts", "shirt" };


cout << word[rand()%15][6];



return;

}


Works fine... it gets a random word every time, but what I need to do is *grab* that randomly created one, single it out, and manipulate it.

Ie; if 'dwarf' comes out, I need to grab dwarf; and then make some if statements that show "_ _ _ _ _" and when the user inputs cater, for example, it will put the a in the second spot, and ? in the rest.

I can do the rest.. but I'm having a hard time grabing the word that comes out and saving it to another array/variable and using it by itself... I've tried all variations I can of arrays, and I think I'm not using the right libraries and/or I'm not too sure... -_-

here's the headers I'm using

#include
#include
[Error: Irreparable invalid markup ('<stdlib.h>') in entry. Owner must fix manually. Raw contents below.]

I'm not positive if I'm going about it the right way.. but..

<lj-cut>

void getword()
{


srand ((unsigned)time(0));

char word[15][6] = { "abcde", "munch", "dwarf", "lunch", "float", "fiver", "along", "right", "price", "cream", "words", "niner", "eight", "parts", "shirt" };


cout << word[rand()%15][6];



return;

}


Works fine... it gets a random word every time, but what I need to do is *grab* that randomly created one, single it out, and manipulate it.

Ie; if 'dwarf' comes out, I need to grab dwarf; and then make some if statements that show "_ _ _ _ _" and when the user inputs cater, for example, it will put the a in the second spot, and ? in the rest.

I can do the rest.. but I'm having a hard time grabing the word that comes out and saving it to another array/variable and using it by itself... I've tried all variations I can of arrays, and I think I'm not using the right libraries and/or I'm not too sure... -_-

here's the headers I'm using

#include <iostream>
#include <stdlib.h>
#include <cstdlib>
#include <ctime>

using namespace std;

thanks guys