Advertisement
MulleDK19

Reversing_OriginalSource

Jun 13th, 2012
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <iostream>
  3. #include <time.h>
  4. #include <typeinfo>
  5.  
  6. using namespace std;
  7.  
  8. class Calculator
  9. {
  10. private:
  11.     int a;
  12.     int b;
  13.  
  14. public:
  15.     Calculator(int a, int b)
  16.     {
  17.         this->a = a;
  18.         this->b = b;
  19.     };
  20.  
  21.     int Add()
  22.     {
  23.         return this->a + this->b;
  24.     }
  25.  
  26.     int Subtract()
  27.     {
  28.         return this->a - this->b;
  29.     }
  30. };
  31.  
  32. DECLSPEC_NOINLINE void PrintResult(char* message, int result)
  33. {
  34.     char msg[128];
  35.     sprintf(msg, "%s: %d", message, result);
  36.     MessageBoxA(NULL, msg, message, MB_ICONINFORMATION);
  37. }
  38.  
  39. DECLSPEC_NOINLINE void DoIt()
  40. {
  41.     Calculator* calc = new Calculator(16, 4);
  42.  
  43.     int added = calc->Add();
  44.     int subtracted = calc->Subtract();
  45.  
  46.     PrintResult("Added result", added);
  47.     PrintResult("Subtracted result", subtracted);
  48.  
  49.     delete calc;
  50. }
  51.  
  52. int main()
  53. {
  54.     DoIt();
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement