单项选择题标准化考试系统

这个C++程序实现了一个单项选择题标准化考试系统,包括录入试题、随机抽取答题、删除试题等功能。用户可以按照指定格式录入试题,然后进行随机抽题并判断答案。程序读取和写入数据到'question.txt'文件。
摘要由CSDN通过智能技术生成

#include
#include
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include
using namespace std;
class Question
{
public:
void set(string question,string A,string B,string C,string D,string key)
{
this->question = question;
this->A = A;
this->B = B;
this->C = C;
this->D = D;
this->key = key;
}
void Putques1(int i)
{
cout << “(” << i+1 << “)” << question << endl;
cout << A << endl;
cout << B << endl;
cout << C << endl;
cout << D << endl;
}
string put()
{
string str;
str = question + " " + A + " " + B + " " + C + " " + D + " " + key + “\n”;
return str;
}
string getkey()
{
return key;
}
private:
string question, A, B, C, D, key;
};
void Menu();
void Remenu();
void Answer();
void Add();
void Readfile();
void Delete();
int Total();
void Add()
{
fstream file;
string ch;
system(“cls”);
cout<<"="<<endl;
cout<<"| 试题录入 |"<<endl;
cout<<"
="<<endl;
file.open(“question.txt”,ios::out|ios::app);
if (!file.is_open())
{
cout << “打开文件失败” << endl;
exit(1);
}
cout << “请按照以下格式分别录入问题、ABCD四个选项及正确答案并以#结束:” << endl;
cout << “例:步入人生新阶段,确立新目标,开启新征程,需要对()有深入的了解和真切的感悟。” << endl;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值