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; }
3 odpowiedzi
0
1) You don't have to use the first For Loop, just write cin>>a;
2) Where do you print the final string?
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.
0
in if it shld be is equal to