Hey I'm just messing around with c++ since I am new to programming and want to know how to close the command prompt when the user input 'N' after he/she gets done with the program.
#include <iostream>
#include <ctime>
#include <cstdlib>
usingnamespace std;
int randomIntGenerator();
int main()
{
randomIntGenerator();
}
int randomIntGenerator()
{
int max, randomInt, myInt;
char YN;
cout << "Please input max integer: ";
cin >> max;
cout << "Please enter the number you want to find: ";
cin >> myInt;
srand(time(0));
randomInt = (rand() % max) + 1;
while(randomInt!= myInt)
cout << (randomInt = (rand() % max) + 1) << endl;
cout << "You found your integer!!" << endl;
if(randomInt == myInt)
cout << "Would you like to try this again? Y/N: ";
cin >> YN;
if(YN == 'Y')
randomIntGenerator();
else
//code to get the command prompt to close when user inputs N
}