Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string bigger(string a, string b)
- {
- if(a == b) return a;
- if(a.length() != b.length())
- return ((a.length() > b.length()) ? (a) : (b));
- int i = 0;
- while(a[i] == b[i])
- i++;
- return ((a[i] > b[i]) ? (a) : (b));
- }
- bool compare(string a, string comp, string b)
- {
- if(comp == "==" || comp == ">=" || comp == "<=")
- if(a == b) return true;
- if(comp == "==") return false;
- if(comp == "!=") return true;
- string bigger_num = bigger(a, b);
- if((comp == ">" || comp == ">=") && bigger_num == a) return true;
- if((comp == "<" || comp == "<=") && bigger_num == b) return true;
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement