Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (anonymous):

progam that inputs a char and dislpays wether it is digit or not using logical and condition operators in c++

OpenStudy (anonymous):

what have you done?

OpenStudy (anonymous):

write progam in c++

OpenStudy (anonymous):

ans????

OpenStudy (anonymous):

#define yes 1 #define no 0 #include <iostream.h> int main(void) { char c[30]; int arr_size, result, i=0, state; cin>>"Enter your digit:= "; cout<<c<<endl; arr_size=(sizeof(c)/sizeof(c[0])); for(i; i < arr_size; i++) { if(check_digit(c[i])) state = yes; else state = no; } if(!state) cout<<It's not a digit<<endl; else cout<<It's a digit<<endl; system("\npause"); return 0; } enjoy.. int check_digit(char c) { return (c>='0' && c<='9'); }

OpenStudy (anonymous):

#define yes 1 #define no 0 #include <iostream.h> int main(void) { char c[30]; int arr_size, result, i=0, state; cin>>"Enter your digit:= "; cout<<c<<endl; arr_size=(sizeof(c)/sizeof(c[0])); for(i; i < arr_size; i++) { if(check_digit(c[i])) state = yes; else state = no; } if(!state) cout<<It's not a digit<<endl; else cout<<It's a digit<<endl; system("\npause"); return 0; } int check_digit(char c) { return (c>='0' && c<='9'); }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!