Need advice regarding Style and Flow in C++ (Simple randomization program)
I come here humbly asking for advice from those with more experience than I.  I believe this is a novice question but I hope it is useful to others.  I'm a few months into learning C++ programming and I want to know if I'm moving generally in the right direction or not with the following code.  This is the most advanced thing I've created so far, but it doesn't contain any pointers or references so I'm worried I'm not doing things properly on the memory level.  I appreciate the time of anyone who posts.  I especially want advice regarding moving this type of code to templates and virtual functions.  Thanks in advance!


    //This program's purpose is a simple battle simulator and a simple lotto simulator
    //This requires two classes and a bit of procedural main game logic that can repeat
     
    //The first class is a Randomizer class that allows the user to generate
    //random numbers by inputting the desired amount of numbers, and the max
    //range for those numbers. The default start value is 1.
     
    //The second class is a Battler class that contains two Randomizer objects.
    //It also contains a method to compare the second integer of each of the vector
    //arrays contained in each of those objects, and returns -1, 0, or 1 depending
    //on which value is greater, or 0 if they are tied.
     
    #include <iostream>     //Necessary for cout and endl
    #include <ctime>        //Necessary for time_t variable
    #include <cstdlib>      //Necessary for rand and srand
    #include <vector>       //Necessary for vector<type>
     
    /*HEADER OF RANDOMIZER CLASS*/
    class Randomizer    //The preferred syntax is to start with a capital letter for classes
    {
        private:
        time_t timevalue;           //time_t member variable that will be set later
        void randomTimeInit();      //called by constructor (runs once)
     
        public:
        Randomizer()    //Class constructor
        {
        srand(time(NULL));      //This is JUST necessary here to get new results every time
                                //Caution: Only run once per program execution! (per object?)
        void randomTimeInit();  //This function sets time_t value and seeds rand() with it
        std::cout << "construct randomizer" << std::endl;   //UNCOMMENT FOR DEBUG
        }
        ~Randomizer()   //Class deconstructor
        {
        std::cout << "destruct randomizer" << std::endl;    //UNCOMMENT FOR DEBUG
        }
     
        std::vector<int> randomIntArray;        //The vector array for the random numbers
        int getRandomNumber(int);               //Function to return one random number of max int
        void createRandomIntArray(int, int);    //Function to create random number array
        void printRandomIntArray();             //Function to print created random number array
    };
     
     
    /*IMPLEMENTATION OF RANDOMIZER CLASS*/
    void Randomizer::randomTimeInit()
    {
        time_t timevalue;   //time_t is a special value (usually number of seconds since 00:00)
        time(&timevalue);   //Sets a reference timevalue to the time (requires the special time_t value)
        srand(timevalue);   //Seeds the random generator with timevalue
    }
     
    int Randomizer::getRandomNumber(int max)
    {
        return rand() % max +1;    //Returns random int %modulo (max value) + 1 (to eliminate 0)
    }
     
    void Randomizer::createRandomIntArray(int count, int max)
    {
        for(int i=1;i<=count;i++)  //Iterates up to the count value
        {
            int randomInt = getRandomNumber(max);                       //Sets randomInt to 1-to-max
            randomIntArray.insert(randomIntArray.begin(), randomInt);   //Inserts randomInt at start of vector
        }
    }
     
    void Randomizer::printRandomIntArray()
    {
        for(unsigned int j=0;j<randomIntArray.size();j++)        //Iterates up to previously created vector size
        {
            std::cout << randomIntArray[j] << " ";               //Outputs number value at [j] followed by a space
        }
    }
     
     
    /*HEADER OF BATTLER CLASS*/
    class Battler
    {
        private:
        Randomizer random1, random2;            //Two Randomizer objects that will each have different values
        int numOne, maxOne, numTwo, maxTwo;     //Four variables for setting up the battle
     
        public:
        Battler()   //Class constructor
        {
            std::cout << "con battler" << std::endl;    //UNCOMMENT FOR DEBUG
        }
        ~Battler()  //Class destructor
        {
            std::cout << "decon battler" << std::endl;  //UNCOMMENT FOR DEBUG
        }
     
        int doBattler();        //Function that compares values between the Randomizer objects
    };
     
     
    /*IMPLEMENTATION OF BATTLER CLASS*/
    int Battler::doBattler()
    {
        numOne = 5;     //Five numbers to choose from for the battle (arbitrary)
        maxOne = 100;   //Value up to 100 for the "damage" number (arbitrary)
        numTwo = 5;     //Five numbers to choose from for the battle (arbitrary)
        maxTwo = 100;   //Value up to 100 for the "damage" number (arbitrary)
        random1.createRandomIntArray(numOne, maxOne);   //Generates Player 1s numbers
        random2.createRandomIntArray(numTwo, maxTwo);   //Generates Player 2s numbers
        std::cout << "Here the two scores:" << std::endl;
        random1.printRandomIntArray();      //Prints Player 1s numbers
        std::cout << std::endl;
        random2.printRandomIntArray();      //Prints Player 2s numbers
        std::cout << std::endl;
     
        //This begins the logic to test which player won the round
        //I decided to use a simple return here instead of a switch statement
        //One definite downside of the following code is having to repeat two of the lines
        //in each of the three different statements in order to clear the vector array between rounds
        if(random1.randomIntArray[2] == random2.randomIntArray[2])  //NOTE: this looks at the second integer
                                                                    //of the member arrays and compares
                                                                    //them ((arbitrary) but it has to be a value
                                                                    //inside the array or it crashes)
        {
            std::cout <<"It was a draw!" << std::endl << std::endl;
            random1.randomIntArray.clear();     //This is necessary to clear the vector array between rounds
            random2.randomIntArray.clear();     //If it's not present then the array continues to expand forever
            return 0;                           //Return immediately stops the function and returns this value
        }
        else if(random1.randomIntArray[2] > random2.randomIntArray[2])  //See NOTE above
        {
            std::cout << "Player 1 hits!" << std::endl << std::endl;
            random1.randomIntArray.clear();     //This is necessary to clear the vector array between rounds
            random2.randomIntArray.clear();     //If it's not present then the array continues to expand forever
            return -1;                          //Return immediately stops the function and returns this value
        }
        else
        {
            std::cout << "Player 2 hits!" << std::endl << std::endl;
            random1.randomIntArray.clear();     //This is necessary to clear the vector array between rounds
            random2.randomIntArray.clear();     //If it's not present then the array continues to expand forever
            return 1;                           //Return immediately stops the function and returns this value
        }
    }
     
     
    /*START OF FUTURE MAIN.CPP*/
    /*PROTOTYPE DECLARATIONS*/
    void inputAndPrintRandomIntArray();  //This function takes inputs for amount of numbers  and
                                         //their max value and prints out the created array
    void lottoLoop();                    //This function allows the repetition of the above function
                                         //if the user inputs char 'Y'
    void battleLoop();                   //This function creates a Battler object and player life
                                         //variables and repeats the doBattler function until one player is dead
    void chooseBattleOrLotto();          //This function allows user input to control which of the two
                                         //main functions of the program to run
     
    /*START OF MAIN FUNCTION*/
    int main(int argc, char* args[])     //These arguments for main allow command line access?
    {
        chooseBattleOrLotto();           //Allows user to choose which function program will perform
        return 0;                        //Here because int main expects a return value
    }
     
     
    /*DEFINITION OF MAIN.CPP FUNCTIONS*/
    void inputAndPrintRandomIntArray()
    {
        Randomizer myRandomizer;    //Instantiates an object of the Randomizer class
        int number, maximum;        //These are the variables that will go into Randomizer method
        std::cout << "Enter the amount of numbers for the Lotto Ticket (1-100):";
        std::cin >> number;
        std::cout << "Enter the maximum number from which they will be chosen(1-1000):";
        std::cin >> maximum;
        std::cout << "Here are your Lotto Numbers:" << std::endl;
        myRandomizer.createRandomIntArray(number, maximum);   //This activates Randomizer method with input values
        myRandomizer.printRandomIntArray();                   //This prints the created random int array
        std::cout << std::endl;
    }
     
    void lottoLoop()
    {
        char gameRunning = 'Y';     //This char value will control whether the game continues to loop
        do
        {
            //system("cls");        //apparently dangerous to use, simply clears console
                                    //alternative is cout << string( 100, '\n' ). Remove to see all outputs
            inputAndPrintRandomIntArray();  //Function that takes input and outputs vector array
            std::cout << "Would you like to play again? (must enter Y):";
            std::cin >> gameRunning;
        }
        while(gameRunning == 'Y');  //For some reason I couldn't get || 'y' to work
    }
     
    void battleLoop()
    {
        Battler doSimpleBattle;            //Instantiates an object of the Battler class
        char battleAgain = 'Y';            //Creates a char that controls whether to repeat the battle
     
        //Begins the battle logic do/while loops
        do
        {
            int player1HP = 10;     //Setting the variables here resets them between games
            int player2HP = 10;     //Placing them where the char is above will not work
            do
            {
                int battleResult;                   //Creates a variable to control the if statements
                battleResult = doSimpleBattle.doBattler(); //Sets the variable to the return value of the function
                if(battleResult == -1)              //Looks at the return of the doBattler method
                {
                    player2HP--;                    //Decrements Player 2 health based on this result
                }
                if(battleResult == 1)               //Continues looking at return of doBattler method
                {
                    player1HP--;                    //Decrements Player 1 health based on this result
                }
            }
            while(player1HP > 0  || player2HP > 0); //Continue the game until one player has no health left
     
            if(player1HP == 0)                      //Checks if Player 1's health is zero
            {
                std::cout << "Player 2 wins!" << std::endl;
            }
            else if(player2HP == 0)                 //Checks if Player 2's health is zero
            {
                std::cout << "Player 1 wins!" << std::endl;
            }
            std::cout << "Game over!" << std::endl;
            std::cout << "Play again? (Must be Y to work)";
            std::cin >> battleAgain;                //This is the char input to control repeating the game
            std::cout << std::endl;
        }
        while(battleAgain == 'Y');                  //For some reason I can't get || 'y' to work
    }
     
    void chooseBattleOrLotto()
    {
        char modeSelect = 'L';        //Creates a char that controls mode choice and exit
        std::cout << "Press 'L' for the lottery or 'B' for battle! ('Q' to exit):";
        std::cin >> modeSelect;
        if(modeSelect == 'L')
        {
            lottoLoop();              //Contains a do while loop that allows game repeat
        }
        if(modeSelect == 'B')
        {
            battleLoop();       //Contains a do while loop that runs the battle game with
                                //Player 1 vs Player 2 each having 10 HP that allows repeat
        }
        if(modeSelect == 'Q')
        {
            modeSelect = 'Q';
        }
        else
        {
            std::cout << "Value must match L or B. Q to Exit." << std::endl;
            if(modeSelect != 'Q')
            {
                chooseBattleOrLotto();  //Repeats entire function unless input char equals 'Q'
            }
        }
    }
    
    
     
Need advice regarding Style and Flow in C++ (Simple randomization program)
===

I come here humbly asking for advice from those with more experience than I.  I believe this is a novice question but I hope it is useful to others.  I'm a few months into learning C++ programming and I want to know if I'm moving generally in the right direction or not with the following code.  This is the most advanced thing I've created so far, but it doesn't contain any pointers or references so I'm worried I'm not doing things properly on the memory level.  I appreciate the time of anyone who posts.  I especially want advice regarding moving this type of code to templates and virtual functions.  Thanks in advance!


    //This program's purpose is a simple battle simulator and a simple lotto simulator
    //This requires two classes and a bit of procedural main game logic that can repeat
     
    //The first class is a Randomizer class that allows the user to generate
    //random numbers by inputting the desired amount of numbers, and the max
    //range for those numbers. The default start value is 1.
     
    //The second class is a Battler class that contains two Randomizer objects.
    //It also contains a method to compare the second integer of each of the vector
    //arrays contained in each of those objects, and returns -1, 0, or 1 depending
    //on which value is greater, or 0 if they are tied.
     
    #include <iostream>     //Necessary for cout and endl
    #include <ctime>        //Necessary for time_t variable
    #include <cstdlib>      //Necessary for rand and srand
    #include <vector>       //Necessary for vector<type>
     
    /*HEADER OF RANDOMIZER CLASS*/
    class Randomizer    //The preferred syntax is to start with a capital letter for classes
    {
        private:
        time_t timevalue;           //time_t member variable that will be set later
        void randomTimeInit();      //called by constructor (runs once)
     
        public:
        Randomizer()    //Class constructor
        {
        srand(time(NULL));      //This is JUST necessary here to get new results every time
                                //Caution: Only run once per program execution! (per object?)
        void randomTimeInit();  //This function sets time_t value and seeds rand() with it
        std::cout << "construct randomizer" << std::endl;   //UNCOMMENT FOR DEBUG
        }
        ~Randomizer()   //Class deconstructor
        {
        std::cout << "destruct randomizer" << std::endl;    //UNCOMMENT FOR DEBUG
        }
     
        std::vector<int> randomIntArray;        //The vector array for the random numbers
        int getRandomNumber(int);               //Function to return one random number of max int
        void createRandomIntArray(int, int);    //Function to create random number array
        void printRandomIntArray();             //Function to print created random number array
    };
     
     
    /*IMPLEMENTATION OF RANDOMIZER CLASS*/
    void Randomizer::randomTimeInit()
    {
        time_t timevalue;   //time_t is a special value (usually number of seconds since 00:00)
        time(&timevalue);   //Sets a reference timevalue to the time (requires the special time_t value)
        srand(timevalue);   //Seeds the random generator with timevalue
    }
     
    int Randomizer::getRandomNumber(int max)
    {
        return rand() % max +1;    //Returns random int %modulo (max value) + 1 (to eliminate 0)
    }
     
    void Randomizer::createRandomIntArray(int count, int max)
    {
        for(int i=1;i<=count;i++)  //Iterates up to the count value
        {
            int randomInt = getRandomNumber(max);                       //Sets randomInt to 1-to-max
            randomIntArray.insert(randomIntArray.begin(), randomInt);   //Inserts randomInt at start of vector
        }
    }
     
    void Randomizer::printRandomIntArray()
    {
        for(unsigned int j=0;j<randomIntArray.size();j++)        //Iterates up to previously created vector size
        {
            std::cout << randomIntArray[j] << " ";               //Outputs number value at [j] followed by a space
        }
    }
     
     
    /*HEADER OF BATTLER CLASS*/
    class Battler
    {
        private:
        Randomizer random1, random2;            //Two Randomizer objects that will each have different values
        int numOne, maxOne, numTwo, maxTwo;     //Four variables for setting up the battle
     
        public:
        Battler()   //Class constructor
        {
            std::cout << "con battler" << std::endl;    //UNCOMMENT FOR DEBUG
        }
        ~Battler()  //Class destructor
        {
            std::cout << "decon battler" << std::endl;  //UNCOMMENT FOR DEBUG
        }
     
        int doBattler();        //Function that compares values between the Randomizer objects
    };
     
     
    /*IMPLEMENTATION OF BATTLER CLASS*/
    int Battler::doBattler()
    {
        numOne = 5;     //Five numbers to choose from for the battle (arbitrary)
        maxOne = 100;   //Value up to 100 for the "damage" number (arbitrary)
        numTwo = 5;     //Five numbers to choose from for the battle (arbitrary)
        maxTwo = 100;   //Value up to 100 for the "damage" number (arbitrary)
        random1.createRandomIntArray(numOne, maxOne);   //Generates Player 1s numbers
        random2.createRandomIntArray(numTwo, maxTwo);   //Generates Player 2s numbers
        std::cout << "Here the two scores:" << std::endl;
        random1.printRandomIntArray();      //Prints Player 1s numbers
        std::cout << std::endl;
        random2.printRandomIntArray();      //Prints Player 2s numbers
        std::cout << std::endl;
     
        //This begins the logic to test which player won the round
        //I decided to use a simple return here instead of a switch statement
        //One definite downside of the following code is having to repeat two of the lines
        //in each of the three different statements in order to clear the vector array between rounds
        if(random1.randomIntArray[2] == random2.randomIntArray[2])  //NOTE: this looks at the second integer
                                                                    //of the member arrays and compares
                                                                    //them ((arbitrary) but it has to be a value
                                                                    //inside the array or it crashes)
        {
            std::cout <<"It was a draw!" << std::endl << std::endl;
            random1.randomIntArray.clear();     //This is necessary to clear the vector array between rounds
            random2.randomIntArray.clear();     //If it's not present then the array continues to expand forever
            return 0;                           //Return immediately stops the function and returns this value
        }
        else if(random1.randomIntArray[2] > random2.randomIntArray[2])  //See NOTE above
        {
            std::cout << "Player 1 hits!" << std::endl << std::endl;
            random1.randomIntArray.clear();     //This is necessary to clear the vector array between rounds
            random2.randomIntArray.clear();     //If it's not present then the array continues to expand forever
            return -1;                          //Return immediately stops the function and returns this value
        }
        else
        {
            std::cout << "Player 2 hits!" << std::endl << std::endl;
            random1.randomIntArray.clear();     //This is necessary to clear the vector array between rounds
            random2.randomIntArray.clear();     //If it's not present then the array continues to expand forever
            return 1;                           //Return immediately stops the function and returns this value
        }
    }
     
     
    /*START OF FUTURE MAIN.CPP*/
    /*PROTOTYPE DECLARATIONS*/
    void inputAndPrintRandomIntArray();  //This function takes inputs for amount of numbers  and
                                         //their max value and prints out the created array
    void lottoLoop();                    //This function allows the repetition of the above function
                                         //if the user inputs char 'Y'
    void battleLoop();                   //This function creates a Battler object and player life
                                         //variables and repeats the doBattler function until one player is dead
    void chooseBattleOrLotto();          //This function allows user input to control which of the two
                                         //main functions of the program to run
     
    /*START OF MAIN FUNCTION*/
    int main(int argc, char* args[])     //These arguments for main allow command line access?
    {
        chooseBattleOrLotto();           //Allows user to choose which function program will perform
        return 0;                        //Here because int main expects a return value
    }
     
     
    /*DEFINITION OF MAIN.CPP FUNCTIONS*/
    void inputAndPrintRandomIntArray()
    {
        Randomizer myRandomizer;    //Instantiates an object of the Randomizer class
        int number, maximum;        //These are the variables that will go into Randomizer method
        std::cout << "Enter the amount of numbers for the Lotto Ticket (1-100):";
        std::cin >> number;
        std::cout << "Enter the maximum number from which they will be chosen(1-1000):";
        std::cin >> maximum;
        std::cout << "Here are your Lotto Numbers:" << std::endl;
        myRandomizer.createRandomIntArray(number, maximum);   //This activates Randomizer method with input values
        myRandomizer.printRandomIntArray();                   //This prints the created random int array
        std::cout << std::endl;
    }
     
    void lottoLoop()
    {
        char gameRunning = 'Y';     //This char value will control whether the game continues to loop
        do
        {
            //system("cls");        //apparently dangerous to use, simply clears console
                                    //alternative is cout << string( 100, '\n' ). Remove to see all outputs
            inputAndPrintRandomIntArray();  //Function that takes input and outputs vector array
            std::cout << "Would you like to play again? (must enter Y):";
            std::cin >> gameRunning;
        }
        while(gameRunning == 'Y');  //For some reason I couldn't get || 'y' to work
    }
     
    void battleLoop()
    {
        Battler doSimpleBattle;            //Instantiates an object of the Battler class
        char battleAgain = 'Y';            //Creates a char that controls whether to repeat the battle
     
        //Begins the battle logic do/while loops
        do
        {
            int player1HP = 10;     //Setting the variables here resets them between games
            int player2HP = 10;     //Placing them where the char is above will not work
            do
            {
                int battleResult;                   //Creates a variable to control the if statements
                battleResult = doSimpleBattle.doBattler(); //Sets the variable to the return value of the function
                if(battleResult == -1)              //Looks at the return of the doBattler method
                {
                    player2HP--;                    //Decrements Player 2 health based on this result
                }
                if(battleResult == 1)               //Continues looking at return of doBattler method
                {
                    player1HP--;                    //Decrements Player 1 health based on this result
                }
            }
            while(player1HP > 0  || player2HP > 0); //Continue the game until one player has no health left
     
            if(player1HP == 0)                      //Checks if Player 1's health is zero
            {
                std::cout << "Player 2 wins!" << std::endl;
            }
            else if(player2HP == 0)                 //Checks if Player 2's health is zero
            {
                std::cout << "Player 1 wins!" << std::endl;
            }
            std::cout << "Game over!" << std::endl;
            std::cout << "Play again? (Must be Y to work)";
            std::cin >> battleAgain;                //This is the char input to control repeating the game
            std::cout << std::endl;
        }
        while(battleAgain == 'Y');                  //For some reason I can't get || 'y' to work
    }
     
    void chooseBattleOrLotto()
    {
        char modeSelect = 'L';        //Creates a char that controls mode choice and exit
        std::cout << "Press 'L' for the lottery or 'B' for battle! ('Q' to exit):";
        std::cin >> modeSelect;
        if(modeSelect == 'L')
        {
            lottoLoop();              //Contains a do while loop that allows game repeat
        }
        if(modeSelect == 'B')
        {
            battleLoop();       //Contains a do while loop that runs the battle game with
                                //Player 1 vs Player 2 each having 10 HP that allows repeat
        }
        if(modeSelect == 'Q')
        {
            modeSelect = 'Q';
        }
        else
        {
            std::cout << "Value must match L or B. Q to Exit." << std::endl;
            if(modeSelect != 'Q')
            {
                chooseBattleOrLotto();  //Repeats entire function unless input char equals 'Q'
            }
        }
    }
    
    
     