Box It!

  • + 0 comments

    Haha, if you, like me, feel dumb because you've met all the requirements but don't understand what they want from you, and you've chosen C++20 as your language, just relax, they forgot to add 'main.' Just switch to a different C++ version and copy it from there or from the message below. I hope they fix this soon. Good luck to everyone, and have a nice day. P.S. When attempting the third test, consider whether your numbers might exceed the 'int' range during multiplication in 'CalculateVolume.' Good luck! :) `void check2() { int n; cin >> n; Box temp;

    for (int i = 0; i < n; i++) {
        int type;
        cin >> type;
    
        if (type == 1) {
            cout << temp << endl;
        } else if (type == 2) {
            int l, b, h;
            cin >> l >> b >> h;
            Box NewBox(l, b, h);
            temp = NewBox;
            cout << temp << endl;
        } else if (type == 3) {
            int l, b, h;
            cin >> l >> b >> h;
            Box NewBox(l, b, h);
            if (NewBox < temp) {
                cout << "Lesser\n";
            } else {
                cout << "Greater\n";
            }
        } else if (type == 4) {
            cout << temp.CalculateVolume() << endl;
        } else if (type == 5) {
            Box NewBox(temp);
            cout << NewBox << endl;
        }
    }
    

    }

    int main() { check2(); return 0; }