博客内容经历了一次整理,以前发的博文太散、没什么水准,搞的随笔分类越来越多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
View Code

相关文章:

  • 2021-10-30
  • 2022-12-23
  • 2021-10-13
  • 2021-07-28
  • 2021-08-03
  • 2021-05-19
  • 2021-05-26
  • 2021-10-01
猜你喜欢
  • 2022-03-08
  • 2021-06-30
  • 2021-05-02
  • 2021-12-28
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案