online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
// Written by Paulo Zemek on December First, 2021. // // The purpose of this sample app is to show that 6/2(1+2) // matches so well some programming standards that we should // be evaluating 2(1+2) differently than 2*(1+2). // // This is all about trying to show some standards to things that seem // to have forgot what a standard is. #include <iostream> class MyInt { public: MyInt(int value): _value(value) { } MyInt operator ()(const MyInt &other) { return MyInt(_value * other._value); } int intValue() const { return _value; } MyInt operator + (const MyInt &other) { return MyInt(_value + other._value); } MyInt operator / (const MyInt &other) { return MyInt(_value / other._value); } MyInt operator * (const MyInt &other) { return MyInt(_value * other._value); } private: int _value; }; int main() { // Unfortunately I don't know if I can replace the int behavior to standard // the 2(3) as a multiplication, so I created names for 1, 2 and 6, and used // the named variables for my calculations. MyInt one(1); MyInt two(2); MyInt six(6); auto equation1 = six/two(one+two); std::cout << "6/2(1+2) = " << equation1.intValue() << std::endl; auto equation2 = six/two*(one+two); std::cout << "6/2*(1+2) = " << equation2.intValue() << std::endl; return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue