Advertisement
Glenpl

divide & modulo strings

Mar 7th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. string divide(string a, string b)
  2. {
  3.     string xtimes = "0";
  4.     while(compare(a, ">=", b))
  5.     {
  6.         a = subtracting(a, b);
  7.         xtimes = adding(xtimes, "1");
  8.     }
  9.     return xtimes;
  10. }
  11.  
  12. string modulo(string a, string b)
  13. {
  14.     while(compare(a, ">=", b))
  15.         a = subtracting(a, b);
  16.     return a;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement