Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstring>
- using namespace std;
- char s[21], v[]="aeiou",aux;
- int main()
- {
- int pv=-1,pc=-1,i;
- cin.getline(s,21);
- for(i=0; i<strlen(s); i++)
- {
- if(strchr(v,s[i])==0)
- {
- pc=i;
- break;
- }
- }
- for(i=strlen(s)-1; i>0; i--)
- {
- if(strchr(v,s[i])!=0)
- {
- pv=i;
- break;
- }
- }
- if(pv!=-1 && pc!=-1)
- {
- aux=s[pv];
- s[pv]=s[pc];
- s[pc]=aux;
- cout<<s;
- }
- else cout<<"nu exista";
- }
Add Comment
Please, Sign In to add comment