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

25 lines
503 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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;
}