We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Box It!
You are viewing a single comment's thread. Return to all 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;
}
int main() { check2(); return 0; }