Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <vector>
  5. #include <queue>
  6.  
  7. using namespace std;
  8.  
  9. vector <string> processed_lines;
  10.  
  11. vector <string> read_file(string filename) {
  12. vector<string> lines;
  13. fstream file;
  14. file.open(filename.c_str(), fstream::in);
  15. while(!file.eof()) {
  16. string line;
  17. getline(file, line);
  18. lines.push_back(line);
  19. }
  20. return lines;
  21. }
  22.  
  23. vector <string> split(string line) {
  24. vector <string> tokens;
  25. int pos = line.find(" ");
  26. while(pos!=-1) {
  27. tokens.push_back(line.substr(0, pos));
  28. line.erase(0, pos+1);
  29. pos = line.find(" ");
  30. }
  31. tokens.push_back(line);
  32. for(int i=0;i<tokens.size();i++) {
  33. cout<<tokens[i]<<endl;
  34. }
  35. return tokens;
  36. }
  37.  
  38.  
  39.  
  40. int main() {
  41. vector <string> lines = read_file("input.c");
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement