Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <string>
- #include <vector>
- // boredom Program
- using namespace std;
- vector<string> readFromFile(string filename);
- int main() {
- vector<string> game,work;
- vector<vector<string> > all;
- srand(time(0));
- game = readFromFile("game.txt");
- work = readFromFile("work.txt");
- all.push_back(game);
- all.push_back(work);
- // ask for choice and whatnot
- // rand()%all.size()
- // -->rand()%(all[choice1].size())
- // rand()%game.size()
- return 0;
- }
- vector<string> readFromFile(string filename) {
- ifstream inFile;
- vector<string> retVec;
- string temp;
- inFile.open(filename.c_str());
- if(inFile.is_open()) {
- while(inFile.good()) {
- inFile >> temp;
- if(!inFile.eof())
- retVec.push_back(temp);
- }
- } else {
- cout << "There was an error opening \"" << filename << "\" D:" << endl;
- }
- inFile.close();
- return retVec;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement