Skip to content

Instantly share code, notes, and snippets.

@dariusk
Last active June 4, 2020 02:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dariusk/294cbaa7fb348416e865 to your computer and use it in GitHub Desktop.
Save dariusk/294cbaa7fb348416e865 to your computer and use it in GitHub Desktop.
// A Program In Which The Participant May Kill Time
#include <iostream.h> //cin and cout
#include <conio.h> //clrscr() and getch()
#include "apstring.h" //apvector and functions
#include "apvector.h"
#include <fstream.h>
#define words apvector<apstring>
const int MAX = 30;
void main()
{
randomize();
clrscr();
words name(MAX,"");
words verb(MAX,"");
words noun(MAX,"");
apstring temp;
char t;
int count, maxname,maxverb,maxnoun,randname,randverb,randnoun;
ifstream names("names.txt");
if (!names) {cout << "You have no names."; exit(0);}
ifstream verbs("verbs.txt");
if (!verbs) {cout << "You have no verbs."; exit(0);}
ifstream nouns("nouns.txt");
if (!nouns) {cout << "You have no nouns."; exit(0);}
count = 0;
while ((names >> temp) && (count < MAX))
{name[count++] = temp; if (temp == "") break;}
name.resize(--count);
maxname = name.length();
count = 0;
while ((verbs >> temp) && (count < MAX))
{verb[count++] = temp; if (temp == "") break;}
verb.resize(--count);
maxverb = verb.length();
count = 0;
while ((nouns >> temp) && (count < MAX))
{noun[count++] = temp; if (temp == "") break;}
noun.resize(--count);
maxnoun = noun.length();
cout << "Recently foricbly declassified files: proceed?";
if (getch() == 'n') exit(0);
while (1)
{
randname = random(maxname);
randverb = random(maxverb);
randnoun = random(maxnoun);
cout << name[randname] << " " << verb[randverb] << " the " << noun[randnoun] << endl;
t = getch();
if (t == 'q') break;
}
getch();
}
Nixon
Erwin
Darius
Di
Wybili
DaVinci
Mario
Pancho
Eris
Quixote
Gandhi
Christ
Mandrake
Crowley
Clinton
Reagan
Napoleon
Caesar
orangutan
star
bus
hope
alien
messiah
end
NRA
CIA
FBI
PTA
dead
armaments
bomb
jihad
society
school
beast
militia
shot
saw
ate
took
jumped
washed
voided
wrote
was
hated
named
raised
broke
invaded
decimated
infiltrated
cured
lead
armed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment