Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/08/2008, 17:04
Avatar de Fayca
Fayca
 
Fecha de Ingreso: abril-2008
Mensajes: 164
Antigüedad: 16 años, 1 mes
Puntos: 2
Respuesta: Ayuda para una funcion

gracias, tienes razón, me sirvio ya termine esa función.

std::string NextWord()
{
srand(time(NULL));
std::ifstream wordList;
std::string words[1000];
char character;
int newLines = 0;
wordList.open("words");

//upload words with wordList && count newLines
while(wordList)
{
wordList.get(character);
words[newLines] = words[newLines] + character;
if (character == '\n') newLines++;
}
wordList.close();
//make random number
return words[rand() % newLines];
}

Última edición por Fayca; 01/08/2008 a las 18:42