产生原因
自己在做课后练习时,讲char类型替换为了string类型,编译器报错了很多错误,具体的代码如下:
golf.h
#pragma once
#include //原本没有这两句会出错
using namespace std;//原本没有这两句会出错
struct gof
{
string fullname;
int handicap;
};
inline void set_golf(gof& g,string name, int hc);
inline int set_golf(gof& g);
inline void hanicap(gof& g, int hc);
inline void show_golf(const gof& g);
golf_fun.cpp
#include
//#include
#include "golf.h"
using namespace std;
//指定设置
void set_golf(gof& g, const string name, int hc)
{
g.fullname = name;
g.handicap = hc;
}
//输入设置
int set_golf(gof& g)
{
int temp = 1;
cout g.handicap;
cin.get();
return temp;
}
}
//handicap设置
void hanicap(gof& g,int hc)
{
g.handicap = hc;
}
//golf结构体打印
void show_golf(const gof& g)
{
cout |