Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class Q3
  2. {
  3. public:
  4. string& execute(string& left, string& right)
  5. {
  6. try
  7. {
  8. int leftVal = std::stoi(left);
  9. int secondVal = std::stoi(right);
  10.  
  11. int result = leftVal + secondVal;
  12.  
  13. string &rResult(*new string());
  14. rResult = std::to_string(result);
  15.  
  16. return rResult;
  17. }
  18.  
  19. catch (std::exception &ex)
  20. {
  21. string &rResult(*new string(""));
  22. return rResult;
  23. }
  24.  
  25. catch (...)
  26. {
  27. string &rResult(*new string(""));
  28. return rResult;
  29. }
  30. }
  31. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement