qfedu-cpp-level/day2/homework/h5.cpp

25 lines
503 B
C++
Raw Permalink Normal View History

2023-07-25 20:00:23 +08:00
// 1. 2. 创建一个名为 BankAccount 的类,具有成员变量 accountNumber 和 balance以及成员函数 void deposit(double amount) 和 void withdraw(double amount) ,用于存款和取款操作。
#include <iostream>
using namespace std;
class BankAccount
{
public:
long accountNumber, balance;
void deposit(double amount)
{
this->balance += amount;
}
void withdraw(double amount)
{
this->balance -= amount;
}
};
int main()
{
return 0;
}