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

📄 mathquest.h

📁 C++&datastructure书籍源码,以前外教提供现在与大家共享
💻 H
字号:
#ifndef _MATHQUEST_H
#define _MATHQUEST_H

// ask a question involving arithmetic
//
// This class conforms to the naming conventions
// of quiz questions in "A Computer Science Tapestry" 2e,
// this convention requires the following functions:
//
// void Create()     -- ask a new question
// void Ask() const  -- ask the last question Create()'d
//
// bool IsCorrect(const string& answer) const
//     -- return true iff answer is correct to last (Create()) question
// string Answer() const
//     -- return the answer to the last (Create()) question
//
#include <string>
using namespace std;

class Question
{
  public:
    Question();
    
    bool IsCorrect(const string& answer) const;
    string Answer()                      const;
    void Ask()                           const; 
    
    void Create();  // create a new question
         
  private:

    string myAnswer;  // store the answer as a string here
    int myNum1;       // numbers used in question
    int myNum2;
};

#endif

⌨️ 快捷键说明

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