⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pen.h

📁 C++ Source code from a tutorial
💻 H
字号:
#include <string>

enum Color {blue, red, black, clear};
enum PenStyle {ballpoint, felt_tip, fountain_pen};

class Pen {
public:
    Color InkColor;
    Color ShellColor;
    Color CapColor;
    PenStyle Style;
    float Length;
    string Brand;
    int InkLevelPercent;
    void write_on_paper(string words) {
        if (InkLevelPercent <= 0) {
            cout << "Oops! Out of ink!" << endl;
        }
        else {
            cout << words << endl;
            InkLevelPercent = InkLevelPercent - words.length();
        }
    }
    void break_in_half() {
        InkLevelPercent = InkLevelPercent / 2;
        Length = Length / 2.0;
    }
    void run_out_of_ink() {
        InkLevelPercent = 0;
    }
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -