Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <iostream>
- #include <time.h>
- #include <typeinfo>
- using namespace std;
- class Calculator
- {
- private:
- int a;
- int b;
- public:
- Calculator(int a, int b)
- {
- this->a = a;
- this->b = b;
- };
- int Add()
- {
- return this->a + this->b;
- }
- int Subtract()
- {
- return this->a - this->b;
- }
- };
- DECLSPEC_NOINLINE void PrintResult(char* message, int result)
- {
- char msg[128];
- sprintf(msg, "%s: %d", message, result);
- MessageBoxA(NULL, msg, message, MB_ICONINFORMATION);
- }
- DECLSPEC_NOINLINE void DoIt()
- {
- Calculator* calc = new Calculator(16, 4);
- int added = calc->Add();
- int subtracted = calc->Subtract();
- PrintResult("Added result", added);
- PrintResult("Subtracted result", subtracted);
- delete calc;
- }
- int main()
- {
- DoIt();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement