Advertisement
sellmmaahh

OR-skripta Adijata-zad 36-Zamijeni Samoglasnike

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