博客内容经历了一次整理,以前发的博文太散、没什么水准,搞的随笔分类越来越多orz,这次把CPP这本书的课后练习的程序代码放到一起方便查阅与修改。。嗯
9.6.1
#ifndef _9.6.1_H_ #define _9.6.1_H_ #include <iostream> #include <cstring> const int Len = 40; struct golf { char fullname[Len]; int handicap; }; //non-interactive version //function sets golf structure to provided name, handicap //using values passed as arguments to the function void setgolf(golf & g, const char * name, int hc); //interactive version //function solicits name and handicap fron user //and sets the members of g to the values entered //return 1 if name is enterd, 0 if name is empty string int setgolf(golf & g); //function resets handicap to new value void handicap(golf & g, int hc); //function displays contents of golf structure void showgolf(const golf & g); #endif