C++ organize flow of functions : <p>I'm writing a program for a microcontroller in C++, and I need to write a function to input some numbers trough a computer connected to it.</p>

<p>This function should perform many different and well-defined tasks, e.g.: obtain data (characters) from the computer, check if the characters are valid, transform the characters in actual numbers, and many others. Written as a single function it would be at least 500 lines long. So I'll write a group of shorter functions and one "main" function that calls the others in the only meaningful order. Those functions will never be called in the rest of the code (except of course the main function). One last thing - the functions need to pass each other quite a lot of variables.</p>

<hr>

<p>What is the best way to organize those functions? My first tough was to create a class with only the "main" function in the public section and the other functions and the variables shared by different functions as private members, but I was wondering if this is good practice: I think it doesn't respect the C++ concept of "class"... for example to use this "group of functions" I would need to do something like that:</p>

<pre><code>class GetNumbers {
    public:
        //using the constructor as what I called "main" function
        GetNumbers(int arg1, char arg2) {
            performFirstAction();
            performSecondAction();
            ...
        }
    private:
        performFirstAction() {...};
        performSecondAction() {...};
        ...

        bool aSharedVariable;
        int anotherVariable;
        ...
};
</code></pre>

<p>And where I actually need to input those numbers from the computer:</p>

<pre><code>GetNumbers thisMakesNoSenseInMyOpinion (x,y);
</code></pre>

<p>Making the "main" function a normal class method (and not the constructor) seems to be even worse:</p>

<pre><code>GetNumbers howCanICallThis;
howCanICallThis.getNumbers(x,y);
...
//somewhere else in the same scope
howCanICallThis.getNumbers(r,s);
</code></pre>
