提示链接错误,怎么回事?
这是程序#include <iostream.h>
#include <string.h>
class student
{
private:
char *no;
char *name;
float grade;
static int count;
static float sum;
public:
student(char *name1,char *no1,float grade1);
~student();
void show();
static void show_count_sum();
};
student::student(char *name1,char *no1,float grade1)
{
name=new char[strlen(name1)+1];
strcpy(name,name1);
no=new char[strlen(no1)+1];
strcpy(no,no1);
grade=grade1;
--count;
sum=sum+grade;
}
student::~student()
{
delete []name;
delete []no;
--count;
sum=sum-grade;
}
void student::show()
{
cout<<"\n人数:"<<count;
cout<<"\n学号:"<<no;
cout<<"\n成绩:"<<grade;
}
void student::show_count_sum()
{
cout<<"\n 人数:"<<count;
cout<<"\n 成绩:"<<sum;
}
int student::count=0;
float student::sum=0;
void mian()
{
student stu1("maiiho","95001",95);
stu1.show();
student::show_count_sum();
student stu2("shimizu","95002",85);
stu2.show();
stu2.show_count_sum();
}
这是出错信息
--------------------Configuration: ore - Win32 Debug--------------------
Compiling...
ore.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/ore.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
ore.exe - 1 error(s), 0 warning(s)