一、复习题
2.using声明和using编译指令的区别
using声明: using std::cin; using std::cout; using std::endl;
using编译指令:using namespace std;
二、编程练习
头文件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<string> #include "golf.h" //using std::cin; //using std::cout; //using std::endl; using namespace std; void setgolf(golf &g, const char * name, int hc) { strcpy_s(g.fullname, name); g.handicap = hc; } int setgolf(golf &g) { cout << "Enter name:"; cin >> g.fullname; if (g.fullname[0] == '