Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void checkStr(){
- printf("Enter sequence of lowercase letters [a-z]:\n");
- char c =scanf("%c", &c);
- while (c != '\n')
- {
- //char c = 0;
- c = scanf("%c", &c);
- int mixed=0;
- int cons=0;
- int increase = 0;
- int decrease = 0;
- if ((c < 97) || (c > 122) || ((c = scanf("%c", &c)) < 97) || ((c = scanf("%c", &c)) > 122))
- {
- printf("Your text is invalid\n");
- }
- else if (c > (c = scanf("%c", &c)))
- {
- decrease = 1;
- }
- else if (c < (c = scanf("%c", &c)))
- {
- increase = 1;
- }
- else if (c == (c = scanf("%c", &c)))
- {
- cons = 1;
- }
- else
- {
- mixed = 1;
- //break;
- }
- printf("ASCII value of %c = %d\n", c, c);
- if ((mixed == 0) && (cons == 0) && (increase == 0) && (decrease == 1))
- printf("Your text is deacreasing");
- else if ((mixed == 0) && !(cons == 0) && (increase == 1) && (decrease == 0))
- printf("Your text is increasing");
- else if ((mixed == 0) && !(cons == 1) && (increase == 0) && (decrease == 0))
- printf("Your text is constant");
- else
- printf("Your text is mixed");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement