c++ – Can anyone help make my code simpler thank you in advance

Can anyone help me make my code simpler and also I wanna replace INT_MIN, INT_MAX with something else but idk what (without using the #include <bits/stdc++.h> header) In this program I am asked to design a 2 x 2 x 2 Rubik’s cube that is filled with numbers instead of colors.

The squares on every side are initially filled with the same side index. This means that the four squares on the front side are filled with 0’s, the four squares on the right side are filled with 1’s, etc. You are allowed to move the cube in two directions only: Horizontal move (H or h): The first row moves one step in four sides in this order (0 -> 1 -> 2 -> 3 -> 0) Vertical move (V or v): The left column moves one step in four sides in this order ( 0 -> 5 -> 2 -> 4 -> 0)

The program accepts from the the user the number of moves he/she wants to make, accepts the sequence of desired moves. The code then rotates the cube accordingly, then calculates the sum of the four squares on every side of the cube. It finally prints out the maximum and minimum sums found for the six sides on the same line.

``````#include <bits/stdc++.h>
using namespace std;

void horizontalRotation(int cube(6)(2)(2))
{
for (int i = 1; i < 4; i++)
{
std::swap(cube(0)(0)(0), cube(i)(0)(0));
std::swap(cube(0)(0)(1), cube(i)(0)(1));
}
}
void verticalRotation(int cube(6)(2)(2))
{
const int n() = {5, 2, 4, 0};
for (int i = 0; i < 4; i++)
{
std::swap(cube(0)(0)(0), cube(n(i))(0)(0));
std::swap(cube(0)(1)(0), cube(n(i))(1)(0));
}
}

int main()
{

int cube(6)(2)(2);

for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 2; j++)
{
cube(i)(j)(0) = i;
cube(i)(j)(1) = i;
}
}
int n;
cin >> n;
char ch;

while (n--)
{

cin >> ch;

if (ch == 'H' || ch == 'h')
{
horizontalRotation(cube);
}

else if (ch == 'V' || ch == 'v')
{
verticalRotation(cube);
}

else
{
cout << "Invalid";
return 0;
}
}

int max_sum = INT_MIN, min_sum = INT_MAX;
for (int i = 0; i < 6; i++)
{

int sum = 0;

for (int j = 0; j < 2; j++)
sum = sum + cube(i)(j)(0) + cube(i)(j)(1);

if (sum > max_sum)
max_sum = sum;

if (sum < min_sum)
min_sum = sum;
}

cout << max_sum << " " << min_sum << endl;
return 0;
}
$$```$$
``````