Skip to content

Instantly share code, notes, and snippets.

@akashpurandare
Created February 20, 2019 11:20
Show Gist options
  • Save akashpurandare/7c57c9c9105f298e4b81f57ab12de83f to your computer and use it in GitHub Desktop.
Save akashpurandare/7c57c9c9105f298e4b81f57ab12de83f to your computer and use it in GitHub Desktop.
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
vector <string> processed_lines;
vector <string> read_file(string filename) {
vector<string> lines;
fstream file;
file.open(filename.c_str(), fstream::in);
while(!file.eof()) {
string line;
getline(file, line);
lines.push_back(line);
}
return lines;
}
vector <string> split(string line) {
vector <string> tokens;
int pos = line.find(" ");
while(pos!=-1) {
tokens.push_back(line.substr(0, pos));
line.erase(0, pos+1);
pos = line.find(" ");
}
tokens.push_back(line);
for(int i=0;i<tokens.size();i++) {
cout<<tokens[i]<<endl;
}
return tokens;
}
int main() {
vector <string> lines = read_file("input.c");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment