#include < iostream >
using namespace std;
class student
{
public:
student();
int num;
int score;
};
void max(student *a)
{
for (int j=0; j< 5; j++)
{
if (a[0].score < a[j].score)
{a = &a[j];}
}
cout << (*a).num << endl;
}
int main()
{
student *p = new student[5];
for (int i=0; i < 5; i++)
{cin >> p[i].num >> p[i].score;}
max(p);
delete p;
p = NULL;
system("pause");
return 0;
}
error LNK2019: 无法解析的外部符号 "public: __thiscall student::student(void)" (??0student@@QAE@XZ),该符号在函数 _main 中被引用
fatal error LNK1120: 1 个无法解析的外部命令
头文件#include
for (int i=0;i {
}//这段代码你重新整理一下
class student
{
public:
student();
int num;
int score;
};
这里写成了类,却不去实现类。。。。。