Advertisement
Guest User

#3 remastii

a guest
Apr 21st, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.08 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4.  
  5. int daLiJeMalo(char c) {
  6.     return ((c >= 'a' && c <= 'z')); }
  7.  
  8. main() {
  9.     char c;
  10.     char str[2048];
  11.     int imaSlova = 0;
  12.    
  13.     int ind = 0;
  14.     char preth;
  15.     int pretInd;
  16.     int rastuci = 1;
  17.    
  18.     while((c = getchar()) != '.') {
  19.         str[ind] = c;
  20.         ind++;
  21.     }
  22.    
  23.     for(int i = 0; i<ind; i++) {
  24.         if(!isdigit(str[i]) && daLiJeMalo(str[i])) imaSlova = 1;
  25.     }
  26.    
  27.     if(imaSlova) printf("Ima malih slova abecede \n");
  28.     else printf("Nema malih slova abecede \n");
  29.    
  30.     for(int i = 0; i<ind; i++) {
  31.         if(!isdigit(str[i]) && daLiJeMalo(str[i])) {
  32.             //ne znam b drugu stavku
  33.         }
  34.     }
  35.    
  36.     for(int i = 0; i<ind; i++) {
  37.         if(!isdigit(str[i]) && daLiJeMalo(str[i])) {
  38.             preth = str[i];
  39.             pretInd = i;
  40.             break;
  41.         }
  42.     }
  43.    
  44.     for(int i = pretInd+1; i<ind; i++) {
  45.         if(!isdigit(str[i]) && daLiJeMalo(str[i])) {
  46.             if(str[i] < preth || str[i] > preth+1)rastuci = 0;
  47.             else preth = str[i];
  48.         }
  49.     }
  50.    
  51.     if(rastuci) printf("Sva slova su poredjana po abecedi \n");
  52.     else printf("Slova nisu poredjana po abecedi \n");
  53.    
  54.     system("PAUSE");
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement