#include <iostream.h> #include <stdio.h> #include <conio.h> #include <string.h> #include <ctype.h> #include <process.h> int main() { char state = '0'; char ch = NULL; char token[20]={NULL}; char stt[3][2]= {NULL, '2', '0', '1', '1', '1'}; cout<<"Input integer value : "; cin>>token; for(int i=0; token[i] != NULL; i++) { if(isdigit(token[i])) { ch='2'; } else { printf("Invalide value"); getchar(); exit(0); } for(int j=1; j<3 && ch != stt[0][j]; j++); for(int k=1; k<2 && state != stt[k][0]; k++); state=stt[k][j]; } printf("Valide value"); getchar(); return 0; }
No comments:
Post a Comment