Take an Integer and print it in a Different Base Recursively (c++) This was for a school project in my Data Structures class (I am still a very very young programmer). The purpose was to pass an interger and a base into a function and print out the result of changing that integer into that base. The project guidelines state that we can only pass an integer that is &gt;= 0 and &lt;= 1000000000.
The Main Function uses ifstream to stream a text document with the input into the main function.
I would like to know if there is anyway I can improve upon the BaseConverter function or anything else in the program before I submit it for grading.
I will put the full program below:
#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

/****************************************************************************************************
Function Name: BaseConverter
Description: The purpose of this function is to take the user decimal number and base that are passed
             to it and use them to recursively convert the decimal number into the base. The function
             prints the correct result to the problem onto the screen and returns void.
*****************************************************************************************************/

void BaseConverter(int num, int base)
{
    if (num == 0)
    {
        cout &lt;&lt; &quot;&quot;;
    }

    if (num &gt;= base)
    {
        BaseConverter(num / base, base);

        if (num % base &gt; 9)
        {
            cout &lt;&lt; char(num % base + 55);
        }
        else
        {
            cout &lt;&lt; num % base;
        }
    }

    else
    {
        cout &lt;&lt; num % base;
    }
}

/*****************************************************************************************************
MAIN PROGRAM   
******************************************************************************************************/

int main()
{
    ifstream fin(&quot;numbers.txt&quot;);
    
    int userNum, base;

    //sentinel control loop
    fin &gt;&gt; userNum &gt;&gt; base;
    while (userNum &gt;= 0)
    {
        //display for input to ensure that correct input is being passed
        cout &lt;&lt; userNum &lt;&lt; &quot; &quot; &lt;&lt; base &lt;&lt; endl;

        if (userNum &gt; 1000000000)
        {
            cout &lt;&lt; &quot;Decimal number too large for this program&quot; &lt;&lt; endl;
            cout &lt;&lt; endl;
        }
        else 
        {
            // call for function and output display
            cout &lt;&lt; userNum &lt;&lt; &quot; in base &quot; &lt;&lt; base &lt;&lt; &quot; is &quot;;
            BaseConverter(userNum, base);
            cout &lt;&lt; endl;
            cout &lt;&lt; endl;
        }

        fin &gt;&gt; userNum &gt;&gt; base;
    }

    fin.close();
    return 0;
}
1. Names/Magic numbers
What is the magic number 55 in your base converter function?
I suggest giving it a name.
2. Bounds / Magic numbers / validation
Also, what are the upper and lower bounds on which bases are allowed? Only 2-9 since you are comparing with 9? That should also be specified and checked when reading the input.
3. Code formatting / style
Your code has a lot of space (empty lines and unnecessarily many newlines).
Unless your school requires you to follow that particular style, I suggest reformatting it into a more readable style. You can for example paste it into this formatter to get a more concise and readable code.
https://codebeautify.org/cpp-formatter-beautifier
For example, this is the output of reformatting part of your code.
void BaseConverter(int num, int base) {
  if (num == 0) {
    cout &lt;&lt; &quot;&quot;;
  }

  if (num &gt;= base) {
    BaseConverter(num / base, base);

    if (num % base &gt; 9) {
      cout &lt;&lt; char(num % base + 55);
    } else {
      cout &lt;&lt; num % base;
    }
  } else {
    cout &lt;&lt; num % base;
  }
}

4. cout multiple inputs
You can chain inputs to cout so you don't need to do this
cout &lt;&lt; endl;
cout &lt;&lt; endl;

But rather
cout &lt;&lt; endl &lt;&lt; endl;
5. File reading
It doesn't seem that the requirements for the assignment are to read from a file. If that is correct, I think you should skip the file reading and read from cin or a similar terminal input instead.