My compiler is Code::Blocks. I am trying to eliminate vocals from a character sequence.
#include <iostream>
#include <cstring>
using namespace std;
char sir[256];
int i=0;
int main (){
cout<<"sir=";cin.getline(sir,256);
for (i=strlen(sir);i>0;i--){
if (strstr(sir[i],'aeiou')==0){
strcpy(sir+i,sir+i+1);
break;}}
cout<<"sir="<<sir<<"\n";
return 0;
}
I receive the following error:
error: call of overloaded 'strstr(char&, int)' is ambiguous
note: candidates are:
note: char* strstr(char*, cost char*) near match
But I think the problem is on strstr command...
'aeiou' is not a string literal in c/c++ use "aeiou". In c/c++ string literal are represented inside " "(double quotes)
Read more here