When I run this it gets the sorting right but it runs though each one and I can't make it stop when it is correct. This is driving me crazy any help is appreciated. Thanks
#include <iostream>
#include <string>
using namespace std;
int main()
{// declaring variables//
int userInput;
cout << "Enter a number between 0 and 36 ."endl;
cin >> userInput;
//validating user input within range.//
while (userInput > 36)
{
cout << "\n";
cout << " !ERROR!: You must enter a number between 0 and 36" << endl;
cin >> userInput;
}
cout << "\n";
{
Your while loops can be greatly simplified. As @helios said, you're basically separating segments of your input for no reason. Also think about what happens when the user enters a number, like say... (-1).
Also try not to use system(anything). Your program has no reason to call upon the operating system to shut it down.