I'm trying to code a simple program that prints out stars in the shape of a hill. It works by taking a user input width and printing the number of stars up until the width specified is reached. The main section of code that's printed is finished. However, I'm having issues trying to ensure the inputted number is odd. If the number is even, the function is supposed to continue asking the user to input another number until they input an odd number.
The relevant part of the code:
int rowsinput;
cout << "Enter an odd number width: ";
cin >> rowsinput;
if (rowsinput % 2 == 0)
{
cout << "Please enter an odd number width: ";
}
else
If anyone needs me to post the entire code please comment.