编了个C++程序出错,编译器指出行数有问题(为226行),帮忙看看哪错了

来源:百度知道 编辑:UC知道 时间:2024/06/25 19:18:55
file1.h
class golf
{
private:
char fullname[40];
int handicap;
public:
golf();
golf(const char*name,int hc);
void setgolf();
void hhandicap(int hc);
void show();
}
file2.cpp
#include"file1.h"
#include<cstring>
#include<iostream>
using namespace std;
golf::golf()
{
strcpy(fullname,"no name");
handicap=0;
}
golf::golf(const char*name,int hc)
{
strncpy(fullname,name,40);
fullname[39]='\0';
handicap=hc;
}
void golf::setgolf()
{
cout<<"Enter the fullname: ";
char dong[40];
cin.getline(dong,40);
strcpy(fullname,dong);
cout<<"Enter the hanicap: ";
int xi;
cin>>xi;
handicap=xi;
}

void golf::hhandicap(int hc)
{
handicap=hc;
}
void golf::show()
{
cout<<&qu

golf类的声明最后}后面要加个分号

麻烦把226行指出来,还有出了什么错指出来

编译器指出的问题,你如果认真分析,一定能找出来的

类的声明最后要加分号,否则会出现一些很奇怪的错误.