c++出现oneormoremultiplydefinedsymbolsfound错误? - 爱问答

(爱问答)

c++出现oneormoremultiplydefinedsymbolsfound错误?

#include <iostream>

#include <string>

using namespace std;

class student

{

public:student(char m_name[30],int m_id,float m_math);

   ~student();

   void show()

   {

   cout<<"name"<<name<<endl;

   cout<<"num"<<id<<endl;

   cout<<"chengji"<<math<<endl;

   }

   static float average();

private:char name[30];

int id;float math;

static float sum; 

static int aver;

};

student::student(char m_name[30],int m_id,float m_math)

{

strcpy(name,m_name);

id=m_id;

math=m_math;

sum+=math;

aver++;

}

student::~student()

{

}

float student::average()

{

return (sum/aver);

}

float student::sum=0;

int student::aver=0;

int main()

{

student stud1("邱锦群",24,85);stud1.show();

student stud2("王小琳",4,55);stud2.show();

student stud3("李小琳",21,95);stud3.show();

cout<<student::average()<<endl;

return 0;

}


程序只是少了一个头文件

#include <cstring>

c++出现one or more multiply defined symbols found错误?


下一篇:韩语好学吗?

上一篇:华为Mate系列、nova、P、畅想、麦芒这五大系列手机,各自代表什么意思啊?

热门标签:
英语 谜语 作文 数学 公式 语文 物理 化学 工艺 java c语言 实验 方程 金属 分子 数据库 硫酸 酒精 运算 石油 vc 世界大战 php 化合物 mysql
最新更新:
电学的一个小问题 为什么打点计时器只能粗略瞬时速度 lookdownupon用法 中专都考不上大学有必要复读一年吗? 如图,已知∠B=∠DEF,AB=DE,请添加一个条件使△ABC≌△DEF,则需添加的条件是__________. 求曲线y=2x^2和直线y=2的所围图形的面积 夜上受降城闻笛是哪句 这个怎么填数字? 小明家下五层楼是5楼,那么小明家上五层楼是几层楼? 填空题,这个题目是怎么算的呢…… 22335577()143中括号里填什么数字。 懂得人帮我看一下这个英文是啥意思??? 最小的物质单位是什么 怎么估算根号52000000 about的重读字母是哪里