i not sure is it appropriate to post it here there seen to be not a single thread on C++ and i urgently need to solve this problem.
its about like this, in c++ how do u compare a numberic and a non-numberic?
My mentor gave us a test on C++ and one of the question is to test the characters the user input.
the code will loop and ask for input for 5 character(a-z & 0-9), and you have to tell how many numberic and how many non-numberic is there in the loop.
below is my source codes
thxs
#include <iostream>
using namespace std;
int main(void){
char letter[5];
int num=0, non=0;
int i;
for(i=0 ; i<5 ; i++){
cout << "Enter " << i+1 << " char: ";
cin >> letter*;
}
for(i=0 ; i<5 ; i++){
if(letter* > 0){
num++;
}else{
non++;
}
}
i=0;
cout << "You entered ";
while(i<5){
cout << letter*;
i++;
}
cout <<endl<< "No. of Numeric: " << num << endl;
cout << "No. of Non-numeric: " << non << endl;
return 0;
}