Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int length (char *s) {
- int duzina=0;
- while (*(s++)!='\0') duzina++;
- return duzina;
- }
- int VelikoSlovo (char c) {
- if (c>='A' && c<='Z') return 1;
- return 0;
- }
- int MaloSlovo (char c) {
- if (c>='a' && c<='z') return 1;
- return 0;
- }
- int JeLiSamoglasnik (char c) {
- if (tolower(c)=='a' || tolower(c)=='e' || tolower(c)=='i' || tolower(c)=='o' || tolower(c)=='u' ) return 1;
- return 0;
- }
- void ZamijeniSamoglasnike (char *s) {
- int i;
- for (i=0; i<length(s); i++) {
- if (JeLiSamoglasnik(s[i])) {
- if (VelikoSlovo(s[i])) s[i]+=32;
- else if (MaloSlovo(s[i])) s[i]-=32;
- }
- }
- }
- int main () {
- char s[100]="Zamijenimo samoglasnike.";
- ZamijeniSamoglasnike(s);
- printf("%s",s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement