Code:
#include <iostream>
using namespace std;
int choice(0);
void display (int);
int main()
{
cout<<"Please enter the times table you would like to see : ";
cin>>choice;
while( choice >13 );
if (choice>0)
display (choice);
else
return 0;
}
void display(int)
{
cout <<endl<<endl;
cout <<"Here is the "<<choice<<" times table :"<<endl;
for(int x=1;x<13;x++)
cout<<choice<<" times "<<x<<" = "<<choice*x<<endl;
}
The code should display a times table if 'choice' is less than 13 ie up to a 12 times table, but the while only works if i make it 'while choice >13' if I make it '<13' it just hangs but compiles OK.
Also the program is exiting after the first table disply, shouldn't it keep going until I input '0'?
Sorry if this is really simple I have spent an hour trying to get it to run properly!!