📄 golf.cpp
字号:
// golf.cpp -- contains functions called in header.cpp
#include "header.h"
#include <iostream>
#include <cstring>
using namespace std;
void setgolf (golf & g, const char * name, int hc)
{
strcpy(g.fullname,name);
g.handicap = hc;
}
int setgolf( golf &g)
{
using namespace std;
cout<<"Please input the name: "<<endl;
cin.getline(g.fullname,Len);
if('\0' == g.fullname[0]) //如果fullname为空字符串返回0
return 0;
cout<<"Please input the handicap of "<<g.fullname<<": \n";
while( !(cin>>g.handicap) )
{
cin.clear();
while(cin.get() != '\n') //去掉输入流中其它的字符
continue;
cout<<"Please input a integer for handicap."<<endl;
}
while(cin.get() != '\n') //去掉输入流中其它的字符
continue;
return 1; //输入结束返回1
}
void handicap (golf & g,int hc)
{
g.handicap = hc;
}
void showgolf (const golf &g)
{
cout<<"name: "<<g.fullname<<endl;
cout<<"handicap: "<<g.handicap<<endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -