Advertisement
sellmmaahh

OR-Promjeni Samoglasnike-Velika-Mala

Sep 6th, 2015
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int length (char *s) {
  6.     int d=0;
  7.     while (*(s++)!='\0') d++;
  8.     return d;
  9. }
  10. int JeLiSamoglasnik (char c) {
  11.     if (tolower(c)=='a' || tolower(c)=='e' || tolower(c)=='i' || tolower(c)=='o' || tolower(c)=='u') return 1;
  12.     return 0;
  13. }
  14.  
  15. int JeLiVeliko (char c) {
  16.     if (c>='A' && c<='Z') return 1;
  17.     return 0;
  18. }
  19. int JeLiMalo (char c)
  20. {
  21.     if (c>='a' && c<='z') return 1;
  22.     return 0;
  23. }
  24.  
  25. void Promjeni(char *s) {
  26.     int i;
  27.     for (i=0; i<length(s); i++)
  28.      {
  29.          if (JeLiSamoglasnik(s[i])) {
  30.                 if (JeLiVeliko(s[i])) s[i]+=32;
  31.                 else if (JeLiMalo(s[i])) s[i]-=32;
  32.          }
  33.      }
  34. }
  35.  
  36.  
  37. int main () {
  38.     char s[]="Selma234 je bIlA 5678 ovdje 123.";
  39.     Promjeni(s);
  40.     printf("%s", s);
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement