📄 系统程序文挡1.txt
字号:
end
else
showmessage('对不起!填空题库中没有试题!');
end
else
begin//将外语试题插入试卷题库
chuansong.SQL.Clear ;
chuansong.SQL.Add('select * from 外语选择题库');
chuansong.Open;
if not chuansong.IsEmpty then
begin
h:=qurand(7,chuansong.RecordCount);
chuansong.SQL.Clear ;
chuansong.SQL.Add('insert into 考卷试题库 (题号,题型,题目,选项A,选项B,选项C,选项D,正确答案,所属课程) select 题号,题型,题目,选项A,选项B,选项C,选项D,正确答案,所属课程 from 外语选择题库 where 题号=:no');
for k:=0 to cunrnd.Items.Count-1 do
begin
chuansong.ParamByName('no').AsString :=cunrnd.items.strings[k];
chuansong.ExecSQL ;
end;
chuansong.SQL.Clear ;
end;
end;
end
else
showmessage('对不起!选择题库中没有试题!');
//插入外语填空试题
chuansong.SQL.Clear ;
chuansong.SQL.Add('select * from 外语填空题库');
chuansong.Open;
if not chuansong.IsEmpty then
begin
h:=qurand(7,chuansong.RecordCount);
chuansong.SQL.Clear ;
if xuanke.selke.tag=1 then
begin
chuansong.SQL.Add('insert into 考卷试题库 (题号,题型,题目,选项A,选项B,选项C,选项D,填空数目,所属课程) select 题号,题型,题目,空1,空2,空3,空4,填空数目,所属课程 from 外语填空题库 where 题号=:no');
for k:=0 to cunrnd.Items.Count-1 do
begin
chuansong.ParamByName('no').AsString :=cunrnd.Items.Strings[k];
chuansong.ExecSQL ;
end;
end;
end
else
showmessage('对不起!填空题库中没有试题!');
chuansong.SQL.Clear ;
chuansong.SQL.Add('select * from 考卷试题库');
chuansong.Open;
if not chuansong.IsEmpty then //用试卷形式展示所选试题
begin
form6.show;
form6.query1.ParamByName('tixing').AsString :='选择题';
form6.query1.open;
form6.shumu.Caption :=inttostr(form6.Query1.RecordCount );
form6.gh.Visible :=true;
form6.cunjuan.Visible:=true;
if panel1.tag=0 then
begin
while button3.tag=0 do //得到唯一的试卷号
begin
seljuanno.Close;
juanno:=trunc(random(200))+1;
seljuanno.ParamByName('no').AsString :=inttostr(juanno);
seljuanno.Open;
if seljuanno.IsEmpty then
begin
form6.juanno.Caption:=form6.juanno.Caption +': '+inttostr(juanno);
button3.Tag:=1;
end;
end;
panel1.Tag:=1;
form6.kecheng.Caption:=form6.kecheng.Caption +': '+teacher.ke.Text;
end;
end;
form5.Close;
end;
procedure TForm5.Button1Click(Sender: TObject); //功能注释
begin
showmessage('由系统自动完成试卷生成的全部过程,包括(题型,试题数目,各题型分值,试卷内容)');
end;
procedure TForm5.Button2Click(Sender: TObject);
begin
showmessage('由教师选择(题型,试题数目,各题型分值)再由系统完成试卷生成操作!');
end;
procedure TForm5.Button3Click(Sender: TObject);
begin
showmessage('由教师选择("题目",题型,试题数目,各题型分值)再由系统完成试卷生成操作!');
end;
procedure TForm5.FormCreate(Sender: TObject);
begin
randomize();
end;
procedure TForm5.banzidongClick(Sender: TObject);
begin //半自动选题
if banzidong.Checked =true then
begin
form7.show;
banzidong.Tag:=1;
form7.Timer1.Enabled :=true;
form5.Close;
end;
end;
procedure TForm5.shougongClick(Sender: TObject); //由教师自主出题
begin
form8.show;
form8.xuanze.Visible :=true;
form8.tiankong.Visible :=false;
if xuanke.selke.tag=0 then
begin
xk.Text :='线性代数选择题库';
tk.text:='线性代数填空题库';
end
else
begin
xk.text:='外语选择题库';
tk.text:='外语填空题库';
end;
qktk.SQL.Clear ;
qktk.SQL.Add('update '+form5.xk.Text+ ' set 是否选中='+''''+'false'+'''');
qktk.ExecSQL ;
qktk.SQL.Clear ;
qktk.SQL.Add('update '+form5.tk.Text+ ' set 是否选中='+''''+'false'+'''');
qktk.ExecSQL ; //清除是否选中标志
form8.xuanti.SQL.Add('select * from '+xk.text);
form8.xuanti.Open;
form8.shumu.Caption :=inttostr(form8.xuanti.RecordCount );
form5.Close;
end;
procedure TForm5.FormActivate(Sender: TObject);
begin
form6.N2.Visible :=false;//隐藏试卷提交按扭
form6.zhengque.Visible :=true;
form6.k1.Ctl3D:=false; //将填空题答案以标签的形式表现
form6.k1.BorderStyle :=bsnone;
form6.k1.Color :=form6.xuanze.Color ; //颜色保持一致
form6.k2.Ctl3D:=false;
form6.k2.BorderStyle :=bsnone;
form6.k2.Color :=form6.xuanze.Color ;
form6.k3.Ctl3D:=false;
form6.k3.BorderStyle :=bsnone;
form6.k3.Color :=form6.xuanze.Color ;
form6.k4.Ctl3D:=false;
form6.k4.BorderStyle :=bsnone;
form6.k4.Color :=form6.xuanze.Color ;
end;
var
Form7: TForm7; //半自动出题对话框
implementation
uses unit5, Unit4, Unit6, Unit3;
{$R *.dfm}
procedure kongshu1(); //根据填空数目来设定4个填空框的隐现
begin
case strtoint(form6.kongshu.Text) of
1:begin form6.lk2.Visible :=false;form6.k2.Visible :=false;
form6.lk3.Visible :=false;form6.k3.Visible :=false;
form6.lk4.Visible:=false;form6.k4.Visible :=false;end;
2:begin form6.lk3.Visible :=false;form6.k3.Visible :=false;
form6.lk4.Visible:=false;form6.k4.Visible :=false;end;
3:begin form6.lk4.Visible:=false;form6.k4.Visible :=false;end;
end;
end;
function qurand(num,range1:integer):integer; //按指定的树目范围生成num个不同的随即数
var
i,j,k:integer;
zancun:array[0..100] of integer;
begin
form5.cunrnd.Clear ;
zancun[0]:=trunc(random(range1)+1);
form5.cunrnd.Items.Add(inttostr(trunc(random(range1)+1))) ;
while form5.jiegou.tag<num-1 do
begin
i:=trunc(random(range1)+1);
for j:=0 to form5.Tag do
begin
if i=zancun[j] then
break;
end;
if j>form5.tag then
begin
form5.jiegou.Tag:=form5.jiegou.Tag+1;
form5.Tag:=form5.Tag+1;
zancun[form5.Tag]:=i;
form5.cunrnd.Items.Add(inttostr(i)) ;
end;
end;
form5.cunrnd.Items.Strings[0]:=inttostr(zancun[0]);
form5.Tag:=0;
form5.jiegou.Tag:=0;
end;
procedure TForm7.tjClick(Sender: TObject);
var //提交用户需求
k,h,juanno:integer;
begin
if (isxuan.Checked =false) and ((xs.Text <>'0') or (xzf.text<>'0')) then
showmessage('对不起!您没有选中选择题型!');
if (istian.Checked =false) and ((ts.Text <>'0') or (tzf.text<>'0')) then
showmessage('对不起!您没有选中填空题型!');
form5.button3.Tag:=0;
form5.qktk.ExecSQL ;
if (isxuan.Checked =true) and ((xs.Text ='') or (xzf.Text ='')) then
begin
showmessage('请将选择题信息填写完整!');
end
else
begin
if (istian.Checked =true) and ((ts.Text ='') or (tzf.Text ='')) then
begin
showmessage('请将填空题信息填写完整!');
end
else
begin
//根据需要向考试题库插入试题
if isxuan.Checked =true then
begin//插入选择题
if xuanke.selke.tag=0 then
begin //将线性代数试题插入试卷库
form5.chuansong.SQL.Add('select * from 线性代数选择题库');
form5.chuansong.Open;
if not form5.chuansong.IsEmpty then
begin
h:=qurand(strtoint(xs.Text ),form5.chuansong.RecordCount); //从题库中所有的试题中选择7道题
form5.chuansong.SQL.Clear ;
form5.chuansong.SQL.Add('insert into 考卷试题库 (题号,题型,题目,选项A,选项B,选项C,选项D,正确答案,所属课程) select 题号,题型,题目,选项A,选项B,选项C,选项D,正确答案,所属课程 from 线性代数选择题库 where 题号=:no');
for k:=0 to form5.cunrnd.Items.Count-1 do
begin
form5.chuansong.ParamByName('no').AsString :=form5.cunrnd.items.strings[k];
form5.chuansong.ExecSQL ;
end;
form5.chuansong.SQL.Clear ;
end
else
showmessage('对不起!选择题库中没有试题!');
end
else
begin//将外语试题插入试卷题库
if xuanke.selke.tag=1 then
begin//
form5.chuansong.SQL.Add('select * from 外语选择题库');
form5.chuansong.Open;
if not form5.chuansong.IsEmpty then
begin
h:=qurand(strtoint(xs.Text ),form5.chuansong.RecordCount);
form5.chuansong.SQL.Clear ;
form5.chuansong.SQL.Add('insert into 考卷试题库 (题号,题型,题目,选项A,选项B,选项C,选项D,正确答案,所属课程) select 题号,题型,题目,选项A,选项B,选项C,选项D,正确答案,所属课程 from 外语选择题库 where 题号=:no');
for k:=0 to form5.cunrnd.Items.Count-1 do
begin
form5.chuansong.ParamByName('no').AsString :=form5.cunrnd.items.strings[k];
form5.chuansong.ExecSQL ; //向试卷中插入选择题
end;
form5.chuansong.SQL.Clear ;
end
else
showmessage('对不起!选择题库中没有试题!');
end;
end;
end;//插入选择结束
if istian.Checked =true then
begin//插入填空题
if xuanke.selke.tag=0 then
begin
form5.chuansong.SQL.Clear;
form5.chuansong.SQL.Add('select * from 线性代数填空题库');
form5.chuansong.Open;
if not form5.chuansong.IsEmpty then
begin
h:=qurand(strtoint(ts.Text ),form5.chuansong.RecordCount);
form5.chuansong.SQL.Clear ;
form5.chuansong.SQL.Add('insert into 考卷试题库 (题号,题型,题目,选项A,选项B,选项C,选项D,填空数目,所属课程) select 题号,题型,题目,空1,空2,空3,空4,填空数目,所属课程 from 线性代数填空题库 where 题号=:no');
for k:=0 to form5.cunrnd.Items.Count-1 do
begin
form5.chuansong.ParamByName('no').AsString :=form5.cunrnd.Items.Strings[k];
form5.chuansong.ExecSQL ; //向试卷中插入填空题
end ;
end
else
showmessage('对不起!填空题库中没有试题!');
end
else
begin
form5.chuansong.SQL.Add('select * from 外语填空题库');
form5.chuansong.Open;
if not form5.chuansong.IsEmpty then
begin
h:=qurand(strtoint(ts.Text ),form5.chuansong.RecordCount);
form5.chuansong.SQL.Clear ;
if xuanke.selke.tag=1 then
form5.chuansong.SQL.Add('insert into 考卷试题库 (题号,题型,题目,选项A,选项B,选项C,选项D,填空数目,所属课程) select 题号,题型,题目,空1,空2,空3,空4,填空数目,所属课程 from 外语填空题库 where 题号=:no')
else
form5.chuansong.SQL.Add('insert into 考卷试题库 (题号,题型,题目,选项A,选项B,选项C,选项D,填空数目,所属课程) select 题号,题型,题目,空1,空2,空3,空4,填空数目,所属课程 from 线性代数填空题库 where 题号=:no');
for k:=0 to form5.cunrnd.Items.Count-1 do
begin
form5.chuansong.ParamByName('no').AsString :=form5.cunrnd.Items.Strings[k];
form5.chuansong.ExecSQL ; //向试卷中插入填空题
end;
end
else
showmessage('对不起!填空题库中没有试题!');
end;
end;//插入填空结束
//将所选试题已试卷形式展现在教师面前
form5.chuansong.SQL.Clear ;
form5.chuansong.SQL.Add('select * from 考卷试题库');
form5.chuansong.Open;
if not form5.chuansong.IsEmpty then
begin
form6.show;
if isxuan.Checked =true then
form6.query1.ParamByName('tixing').AsString :='选择题'
else
form6.query1.ParamByName('tixing').AsString :='填空';
form6.query1.open;
form6.shumu.Caption :=inttostr(form6.Query1.RecordCount );
form6.cunjuan.Visible:=true;
form6.gh.Visible :=true;
if form5.panel1.tag=0 then
begin
while form5.button3.tag=0 do //随机产生试卷号
begin
form5.seljuanno.Close;
juanno:=trunc(random(200))+1;
form5.seljuanno.ParamByName('no').AsString :=inttostr(juanno);
form5.seljuanno.Open;
if form5.seljuanno.IsEmpty then
begin
form6.juanno.Caption:=form6.juanno.Caption +': '+inttostr(juanno);
form5.button3.Tag:=1;
end;
end;
form5.panel1.Tag:=1;
form6.kecheng.Caption:=form6.kecheng.Caption +': '+teacher.ke.Text;
end;
end;
//展示完成
end;
end;
if isxuan.Checked =false then //用户没有选择选择题
begin
form6.xuanze.Visible :=false;
form6.tiankong.Visible :=true;
form6.xz.Visible :=false;
form6.tk.Visible :=false;
form6.shumu1.Caption :=form7.ts.Text ;
kongshu1();
end;
if istian.Checked =false then //用户没有选择填空题
begin
form6.xuanze.Visible :=true;
form6.tiankong.Visible :=false;
form6.xz.Visible :=false;
form6.tk.Visible :=false;
end;
form7.Close;
end;
procedure TForm7.xzfKeyPress(Sender: TObject; var Key: Char);
begin
if not ((key>=#48) and (key<=#57) ) then
begin
showmessage('对不起!您输入了非法的字符!');
key:=#13;
xzf.Text:='';
end;
end;
procedure TForm7.tzfKeyPress(Sender: TObject; var Key: Char);
begin
if not ((key>=#48) and (key<=#57) ) then
begin
showmessage('对不起!您输入了非法的字符!');
key:=#13;
tzf.Text:='';
end;
end;
procedure TForm7.xsKeyPress(Sender: TObject; var Key: Char);
begin
if not ((key>=#48) and (key<=#57) ) then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -