大家帮我看一下,是什么错误,找半天了都找不到
# include<iostream.h># include<string.h>
class strings
{
public:
strings(string a);
private:
char contents[50];
int length;
};
strings::strings(string a)
{
int l;
char s[6]="hallo";
l=length(s);
cout<<"The original string and length"<<endl;
cout<<s<<" "<<l<<endl;
contents=s+a;
length=strlen(contents);
cout<<" now string and length"<<endl;
cout<<contents<<" "<<length<<endl;
}
void main()
{
strings sd;
string a;
cout<<"please input a string"<<endl;
cin>>a;
sd(a);
}