Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<ctype.h>
- #include<stdbool.h>
- bool check_input(char *a)
- {
- int i, len;
- len = strlen(a);
- bool x;
- for(i = 0; i < len; i++) {
- if(isdigit(a[i]) || isspace(a[i])) {
- bool x = true;
- }
- else if(a[i] == '+' || '-' || '*' || '/') {
- }
- else{
- return false;
- }
- }
- return true;
- }
- int main()
- {
- char b[500];
- scanf("%s", b);
- if(!check_input(b)) {
- printf("Invalid character in input\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement