I am trying to solve a problem where I am given a string of lowercase characters and I have to convert the vowels to uppercase.
(e.g. : "mother" becomes "mOthEr".
)
My attempt
#include <iostream>
#include <cstring>
using namespace std;
char s[20];
int i;
int main()
{
cin.getline(s,20);
for(i=0;i<20;i++)
{
if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')
s[i]=toupper(s[i]);
}
cout<<s;
}
Could someone tell me what I did wrong? I got Wrong Answer on one of the tests.