Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int daLiJeSamoglasnik(char str) {
- char samoglasnici[11] = "aeiouAEIOU";
- for (int i = 0; i < 10; i++)
- {
- if (str == samoglasnici[i]) {
- return 1;
- }
- }
- return 0;
- }
- void najkraciPodstringSamoglasnika2(char str1[], char str2[]) {
- int i = 0, j = 0, max = 0, duzina, index, temp = 0;
- while (str1[i] != '\0') {
- j = i;
- duzina = 0;
- if (daLiJeSamoglasnik(str1[i])) {
- while (daLiJeSamoglasnik(str1[j]) && str1[j]!='\0') {
- duzina++;
- j++;
- }
- }
- if (duzina < max && duzina != 0 && temp == 1) {
- index = i;
- max = duzina;
- }
- else if (temp == 0 && duzina > 0) {
- index = i;
- max = duzina;
- temp++;
- }
- i = i + duzina + 1;
- }
- for (int i = index; i < duzina + index; i++)
- {
- str2[i - index] = str1[i];
- }
- str2[duzina] = '\0';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement