howdy,
the following code will select a random char however the ASCII values 91 thru 96 are not letters. how would i ignore ASCII values 91 thru 97.
Code:
#include <stdio.h>
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
int main ()
{
system("clear");
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
int c;
int i;
int count= 0;
int under = 0;
int over = 0;
srand(time(0));
for( c = 0; c < 20; c++){
int i = (rand()%57)+65;
char letter = (i) ;//get ASCII code
cout<<"Letter: "<<letter<<" ASCII code: "<<i<<endl;
if(i > 90 && i < 97){
cout<<" ------#"<<endl;
count++;}
if(i < 90){
under++;}
if(i >97){
over++;}
}
cout<<"\nfail numbers: "<<count<<endl;
cout<<"Under: "<<under<<endl;
cout<<"Over: "<<over<<endl;
return 0;
}
Thanks
M.R.