第一题:
知识点:
- string类型的使用也是在namespace std中的,要使用std命名空间
head
#include <string>
#ifndef GOLF_H_INCLUDED
#define GOLF_H_INCLUDED
class Bankaccount
{
std::string m_name;
std::string m_account;
double m_deposit;
public:
Bankaccount(std::string name, std::string account, double deposit)
{
m_name = name;
m_account = account;
m_deposit = deposit;
}
Bankaccount(){}
void Show();
void Indeposit(double money);
void Outdeposit(double money);
};
#endif // GOLF_H_INCLUDED
definition
#include <iostream>
#include "golf.h"
void Bankaccount::Show()
{
using namespace std;
cout << m_name << "\n";
cout << m_account << "\n";
cout << fixed << cout.precision(2)<< m_deposit << "\n";
}
void Bankaccount::Indeposit(double money