Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main ()
- {
- srand(time(NULL));
- char str[256];
- ifstream fin("Story.dat");
- ofstream fout("output.dat"); // open file
- short Rand;
- Rand = ((rand() % 10) + 1);
- while (fin >> str) // loop while extraction from file is possible
- {
- fout << str << endl;
- }
- fin.close();
- fin.open("output.dat");
- while (fin >> str)
- {
- cout << str << ' ';
- }
- cout << endl;
- while (fin >> str)
- {
- if (str == "*nounp*")
- {
- fin.open("nouns.dat");
- for (int i = 0;i < 4; i++)
- {
- fin >> str;
- }
- cout << str;
- fin.open("Story.dat");
- }
- else
- cout << str << ' ';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment