c++ - how can i read a series of character value as character and integer simultaneously and can compare it? -


i have file containing series of characters like:

......//////////0000000111111111222222222aaaaaaaaaaccccccccccccclllllllllllllllll 

i have scan 1 one character , have compare if number or not in form of integer.

i used this:

int x=0; fscanf(fp,"%d",&x) if (x>=0 && x<=9) 

i must have read numbers in file in integer form , have compare it.

in c++:

#include <iostream> #include <locale> char c; int i; while(std::cin >> c) {     if(isdigit(c)) {         = c - '0';     } else {         //todo:     } } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -