Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void checkForOperators(string line){
- for (int i = 0; i < line.length(); i++){
- //Check for compound assignment operators and increment/decrement operators
- if (line.substr(i,2) == "+="
- || line.substr(i,2) == "-="
- || line.substr(i,2) == "*="
- || line.substr(i,2) == "/="
- || line.substr(i,2) == "+="
- || line.substr(i,2) == "%="
- || line.substr(i,2) == ">>="
- || line.substr(i,2) == "&="
- || line.substr(i,2) == "^="
- || line.substr(i,2) == "|="
- || line.substr(i,2) == "++"
- || line.substr(i,2) == "--"
- ){
- if (!search(line.substr(i,2), operators)){
- operators.push_back(line.substr(i,2));
- }
- }
- if ( (line.substr(i,1) == "+" && line.substr(i,2) != "+=")
- || (line.substr(i,1) == "-" && line.substr(i,2) != "-=")
- || (line.substr(i,1) == "*" && line.substr(i,2) != "*=")
- || (line.substr(i,1) == "/" && line.substr(i,2) != "/=")
- || (line.substr(i,1) == "%" && line.substr(i,2) != "%=")
- || (line.substr(i,1) == "=")
- ){
- if (!search(line.substr(i,1), operators)){
- operators.push_back(line.substr(i,1));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement