请教一个c++类的问题,这个程序错在哪儿啊?运行时无法给字符串赋值
程序代码:
#include <iostream.h> using namespace std; class node { private: int ID; char *name; int Tel; public: node () { ID=0;name=0;Tel=0; } node (int a,char *b,int c) { ID=a;name=b;Tel=c; } void setnode() { cout<<"input ID: "<<endl; cin>>ID; cout<<"input name: "<<endl; cin>>name; //这一行代码一直运行出错 cout<<"input Tel: "<<endl; cin>>Tel; } void output() { cout<<ID<<" "<<name<<" "<<Tel<<endl; } ~node(){} }; int main () { node zx; zx.setnode(); zx.output(); return 0; }