Leetcode 1603. Design Parking System Description of the problem:

Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.
Implement the ParkingSystem class:
ParkingSystem(int big, int medium, int small) Initializes object of the ParkingSystem class. The number of slots for each parking space are given as part of the constructor.
bool addCar(int carType) Checks whether there is a parking space of carType for the car that wants to get into the parking lot. carType can be of three kinds: big, medium, or small, which are represented by 1, 2, and 3 respectively. A car can only park in a parking space of its carType. If there is no space available, return false, else park the car in that size space and return true.

Below is my code, I would appreciate any suggestions on how to improve the code.
#include &lt;iostream&gt;

class ParkingSystem {
    
public:
    ParkingSystem(int big, int medium, int small) :
    m_big_max(big),
    m_medium_max(medium),
    m_small_max(small),
    m_big_curr(0),
    m_medium_curr(0),
    m_small_curr(0)
    {}
    
    bool addCar(int carType) {
        if (carType == 1) {
            // big car
            if (m_big_curr == m_big_max) {
                return false;
            } else {
                m_big_curr++;
            }
        } else if (carType == 2) {
            // medium car
            if (m_medium_curr == m_medium_max) {
                return false;
            } else {
                m_medium_curr++;
            }
        } else {
            // small car
            if (m_small_curr == m_small_max) {
                return false;
            } else {
                m_small_curr++;
            }
        }
        
        return true;
    }
    
private:
    int m_big_max;
    int m_medium_max;
    int m_small_max;
    
    int m_big_curr;
    int m_medium_curr;
    int m_small_curr;
    
};

int main() {
    
    ParkingSystem parking_system(1, 1, 0);
    
    std::cout &lt;&lt; &quot;parking_system.addCar(1) &quot; &lt;&lt; parking_system.addCar(1) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;parking_system.addCar(2) &quot; &lt;&lt; parking_system.addCar(2) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;parking_system.addCar(3) &quot; &lt;&lt; parking_system.addCar(3) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;parking_system.addCar(1) &quot; &lt;&lt; parking_system.addCar(1) &lt;&lt; std::endl;

    
    return 0;
}
Observation
You can simplify this using arrays.
You don't need two numbers for each type (max and current). Simply track the number of open spots (per type) and count down.
if you are not using arrays consider a switch statement.
Code Review:
Prefer &quot;\n&quot; over std::endl.
If your main() does not return anything but 0 at the end.
Then leave out the return. It is auto added by the compiler.
Re-Design
template&lt;std::size_t typeCount = 3&gt;
class ParkingSystem
{
    int openSlots[typeCount];
    
    public:
        template&lt;typename... Args&gt;
        ParkingSystem(Args... args)
            : openSlots{args...}
        {}
    
        bool addCar(int type)
        {
            if (openSlots[type - 1] == 0) {
                return false;
            }
            --openSlots[type - 1];
            return true;
        }
};

int main() 
{
    
    ParkingSystem parking_system(1, 1, 0);
    
    std::cout
        &lt;&lt; &quot;parking_system.addCar(1) &quot; &lt;&lt; parking_system.addCar(1) &lt;&lt; &quot;\n&quot;
        &lt;&lt; &quot;parking_system.addCar(2) &quot; &lt;&lt; parking_system.addCar(2) &lt;&lt; &quot;\n&quot;
        &lt;&lt; &quot;parking_system.addCar(3) &quot; &lt;&lt; parking_system.addCar(3) &lt;&lt; &quot;\n&quot;
        &lt;&lt; &quot;parking_system.addCar(1) &quot; &lt;&lt; parking_system.addCar(1) &lt;&lt; &quot;\n&quot;;
}