case'm': cout << "Please enter a number between 1 and 20 to find the multiplication table of: "<<endl;
cin >> number;
if (number<=20)
{
system ("CLS");
cout << "How many lines would you like the table to display? Enter a number between 1 and 15: "<<endl;
cin >> lines;
}
else{
cout<<"Please go back and enter a valid number!";
}break;
if(lines<=15)
{
system("CLS");
for (count = 1; count <= lines ; count++)
{
cout << "This is the multiplication table for the " << number << " times table";
cout<<endl;
cout << count << " * " << number<< " = " << count*number<<endl;
}
}
else{cout<<"Please go back and enter a valid number!";}
break;
The second else statement isn't displaying after you enter an invalid number, instead it is displaying at the same time as the first else statement! Quick help would be greatly appreciated !!
Well, I'm not sure if this will solve it, but you sure don't need a break in line 12. It is outside the else{} so it is executed independantly from whether number <= 20, or not.