declaring strlen

hello

i have some difficulties declaring strlen, im new to programming.


#include <iostream>
#include<string>
using namespace std;
int main()
{
char letters1[20];
char letters2[20];

cout<<"enter a word: ";
cin>>letters1;

int i,k=0, n;

n=strlen(letters1);

for( i=0; i<n; i++)
{
if(letters1[i]=='a' && letters1[i]=='A' &&
letters1[i]=='e' && letters1[i]=='E' &&
letters1[i]=='i' && letters1[i]=='I' &&
letters1[i]=='o' && letters1[i]=='O' &&
letters1[i]=='u' && letters1[i]=='U')
{


letters2[k]=letters1[i];
k++;
}
}

cout<< letters1 <<"has the following" << k <<"vowel letters: "<<endl;
for(i=0;i<k;i++)
cout<< letters2[i]<<" ";

return 0;

}

strlen is in the <cstring> header, not the <string> header.
The <string> header is for the C++ string type.

http://www.cplusplus.com/reference/cstring/strlen/?kw=strlen

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Did you look up that standard function to see what include file is required?

Why did you include the <string> header when you never actually use C++ strings?

@abstractionanon oh i forgot the c in the header, and thanks.

@jlb my bad
Topic archived. No new replies allowed.