# C++ problems

**URL:** <https://forum.kirupa.com/t/c-problems/160113>\
**Category:** web dev\
**Created:** [August 23, 2005, 2:56pm UTC](https://forum.kirupa.com/t/c-problems/160113 "2005-08-23T14:56:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kitaeshi](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@kitaeshi](https://forum.kirupa.com/u/kitaeshi)\
**Post date:** [August 23, 2005, 2:56pm UTC](https://forum.kirupa.com/t/c-problems/160113/1 "2005-08-23T14:56:49Z")

</div>

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;  
}
