You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1006 B
37 lines
1006 B
#ifndef QUESTION_GENERATOR_H_
|
|
#define QUESTION_GENERATOR_H_
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <random>
|
|
|
|
class QuestionGenerator {
|
|
public:
|
|
virtual ~QuestionGenerator() = default;
|
|
|
|
// 生成指定数量的数学题目
|
|
virtual std::vector<std::string> GenerateQuestions(int count,
|
|
const std::string& username) = 0;
|
|
|
|
// 检查题目是否符合难度要求
|
|
virtual bool MeetsDifficultyRequirements(const std::string& question) = 0;
|
|
|
|
protected:
|
|
QuestionGenerator();
|
|
|
|
// 生成指定范围内的随机数
|
|
int GetRandomNumber(int min, int max);
|
|
|
|
// 从运算符列表中随机选择一个运算符
|
|
char GetRandomOperator(const std::vector<char>& operators);
|
|
|
|
std::string current_user_;
|
|
std::mt19937 rng_;
|
|
|
|
private:
|
|
// 禁用拷贝构造和赋值操作
|
|
QuestionGenerator(const QuestionGenerator&) = delete;
|
|
QuestionGenerator& operator=(const QuestionGenerator&) = delete;
|
|
};
|
|
|
|
#endif // QUESTION_GENERATOR_H_
|