What am I doing wrong? I need this program to print out the ASCII code. If i enter a symbol for exampl "& or % or /" I need a message to appear please try again, but if I put "q or Q" it automatically kicks me out. Please, help... heres my program...
Please help... thanks a bunch!Code:#include <iostream>
#include <cctype>
using namespace std;
void main ()
{
char ch;
int asc;
do
{
cout<<"Enter a number or letter: \n";
cin >> ch;
asc=(int)ch;
cout<<ch<<" "<<asc<<"\n";
if (isalnum(ch))
cout<<"Please enter a correct number or letter: \n";
}
while ((ch != 'q') && (ch !='Q'));
}