/********************************************************************** RandWord - Copyright (C) 2007 - Gen. Nazgual, Nerd Army This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ #include #include #include #include #include #define DEBUG int main(int argc, char *argv[]){ using namespace std; vector Words; vector::iterator Counter; string Word; int Num=0,Count=0; time_t now; time(&now); // seed the random number srand(now); // generator with curent time rand();rand();rand(); while(!cin.eof()){ // get a list of words cin >> Word; Words.push_back(Word); } Counter=Words.begin(); while(Counter!=Words.end()){// count how many words we have Count++; Counter++; } Num=rand() % Count; // get a random number (within bounds) #ifdef DEBUG cout << Words[Num] << " [" << Num << "]:(" <