1、
代码:
头文件golf.h代码:
const int Len = 40; struct golf { char fullname[Len]; int handicap; }; void setgolf(golf & g, const char * name, int hc); int setgolf(golf & g); void handicap(golf & g, int hc); void showgolf(const golf & g);
golf.cpp代码
#include<iostream> #include<cstring> #include "golf.h" using namespace std; void setgolf(golf & g, const char * name, int hc) { strcpy(g.fullname, name); g.handicap = hc; } int setgolf(golf & g) { cout<< "请输入全名: "; cin.getline(g.fullname, Len); if (g.fullname[0] == '