求助:關于string
#include <iostream.h>
#include <math.h>
class CString
{
private:
char *p_str;
public:
CString(char *p_s)
{
p_str = new char [strlen(p_s)];
strcpy(p_str, p_s);
}
void print() { cout << p_str << endl; }
~CString() { delete [] p_str; }
};
void main()
{
char p[20];
CString *p_strPtr;
cout << “Enter a string: ”;
cin >> p;
CString s1();
p_strPtr = s1;
p_strPtr.print();
}
錯在哪啊???