帮忙解决问题
#include<iostream>using namespace std;
class Var
{
char word[10];
int num1;
double num2;
public:
void setdata(int i)
{
num1=i;
}
void setdata(double f)
{
num2=f;
}
void setdata(char *c)
{
strcpy(word,c);
}
void showdata()
{
cout<<" Here is int "<<num1<<endl;
cout<<" Here is float "<<num2<<endl;
cout<<" Here is char* "<<word<<endl;
}
};
void main()
{
Var a;
a.setdata(10);
a.setdata(10.10);
a.setdata("ten");
a.showdata();
}
strcpy(word,c); //undeclared identifier这是什么问题?
[ 本帖最后由 晓宁 于 2011-9-12 17:30 编辑 ]