Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<stdio.h>
- #include<string>
- #include<vector>
- using namespace std;
- void checkParser(int type, bool correct)
- {
- if (correct)
- cout << "parsing type: " << type << endl;
- }
- void parserFirstStep(string inputConsole)
- {
- const vector<string> commandList = { "wc","egrep","ls","comm","tail","pwd","dc","man" };
- int type = 0;
- bool checkType = false;
- unsigned int i = 0;
- while((i < commandList.size())&& !checkType)
- {
- int position = inputConsole.find(commandList[i]);
- if (position == 0)
- {
- type = i;
- inputConsole.erase(0, commandList[i].length());
- checkType = true;
- }
- i++;
- }
- checkParser(type, checkType);
- }
- int main()
- {
- string input;
- getline(cin, input);
- parserFirstStep(input);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement