0

why this program does not work? it should eliminate all the letters from the word(the string is a word; no spaces) excluding <a e i o u m>. for example : input: optional output: oioal

#include <iostream> using namespace std; char a[100]; int i,j,s=0; int main() { cout<<"word: "; for(i=0;i<100;i++) {cin>>a[i];} for (i=0;i<100;i++) { if (a[i]!='a'||a[i]!='e'||a[i]!='i'||a[i]!='o' ||a[i]!='u' || a[i]!='m') {for(j=i;j<100;j++) a[j]=a[j++]; s=s+1;} } if(s==0) cout<<"does not exist"; return 0; }

26th Jun 2016, 8:03 PM
Alex H.
Alex H. - avatar
3 Respuestas
0
1) You don't have to use the first For Loop, just write cin>>a; 2) Where do you print the final string?
26th Jun 2016, 9:34 PM
Edi Lipovac
Edi Lipovac - avatar
0
1) you are right. i don't need that..2) on the screen, using cout. not this is the problem. i just want that to work.
26th Jun 2016, 11:19 PM
Alex H.
Alex H. - avatar
0
in if it shld be is equal to
20th May 2017, 6:56 AM
Vindya