学习笔记

image-20241106174640708

我就猜到,跳跃着看会有听不懂的地方,我先把已经敲过的代码放到这里,防止自己之后找不到

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef __STOCK00__H__
#define __STOCK00__H__
#include <string>
class Stock
{
private:
std::string company;
long shares;
double share_val;
double total_val;
void set_tot() { total_val = shares * share_val; }

public:
void acquire(const std::string &co, long n, double pr);
void buy(long num, double price);

void sell(long num, double price);
void update(double price);
void show();
};
#endif

复习题

编程练习