首页 > 学生 > 实习 > 实习报告 > 上机实验报告

上机实验报告

   来源:文书咖    阅读: 1.8W 次
字号:

用手机扫描二维码 在手机上继续观看

手机查看

一. 题目1. 建立一个学生档案,内容包括学号,姓名,年龄,性别,数学,物理和英语3门功课成绩。要求实现以下功能:1) 数据输入;2) 查询某个学生的成绩;3) 按平均排列输出;4) 统计某门课各分数段人数;5) 删除某个学生记录;2. 编程实现对二位数进行加,减,乘运算,每运行一次程序做10道题,完成后给出成绩(每题10分)。二. 设计思想和模块划分1.1.先定义所需要的条件,例如,姓名,学号,性别,三门功课的成绩,平均分等。2.输入姓名,学号,性别,年龄,三门功课的成绩后,就输出相应的姓名,学号,性别,年龄,三门功课的成绩。3.打印表头;4.在求出平均分,并打印出平均分。5.在查找学生,并打印出学生的相关资料;并按照平均分的高低排列;6.在统计学生各科成绩是否》=60分,如果是就是通过,否就是没通过,最后打印出最后的结果。7.删除学生,选中删除的学生,如果确定要,那么该学生的一切记录就变为0;2.1.随机调用函数,产生两个其值为10到99的随机整数分别放在c,d中用作运算时的运算数。2.随机调用函数,产生一个值为1到3 的随机整数放入b中,用来选择不同的运算。根据b的值选择不同的运算。当b=1时,去进行c+d的运算练习;当b=2 时,去进行c-d的运算练习;当b=3时,去进行c×d的运算练习。每完成一个算题就给出是否正确的信息。3.根据答案正确与否统计。正确时,显示’right’; 错误时,显示’wrong’。4.步骤1. 2. 3. 4. 重复10次。5.输出学生成绩。三. 运行结果1. Input the 1 student :num:03name:wfage:18sex:fmath:98phy:75eng:65Input the 2 student :num:06name:scage:17sex:fmath:78phy:45eng:65Input the 3 student :num:09name:ytage:17sex:mmath:69phy:75eng:in s 1 ----------------------------- table-------------------------------------------------------------------------------------------------------------------------------- num name age sex math phy eng ave--------------------------------------------------------------------------------------------------- 3 wf 18 f 98.0 75.0 65.0 79.3--------------------------------------------------------------------------------------------------- 9 yt 17 m 69.0 75.0 50.0 64.7---------------------------------------------------------------------------------------------------- 6 sc 17 f 78.0 45.0 65.0 in s 2Into number:3------------------------------------------------------------------------------------------------ num name age sex math phy eng ave------------------------------------------------------------------------------------------------ 3 wf 18 f 98.0 75.0 65.0 in s 3Into number:6------------------------------------------------------------------------------------------------ num name age sex math phy eng ave------------------------------------------------------------------------------------------------ 6 sc 17 f 78.0 45.0 65.0 62.6 ------------------------------------------------------------------------------------------------true? Y/Ny1 ---------------- table--------------------------------------------------------------------------------------------------------------- num name age sex math phy eng ave------------------------------------------------------------------------------------------------- 3 wf 18 f 98.0 75.0 65.0 79.3-------------------------------------------------------------------------------------------------- 9 yt 17 m 69.0 75.0 50.0 64.7-------------------------------------------------------------------------------------------------- 0 0 0 f 0.0 0.0 0.0 in s 4 t the math t the phy t the eng 1math: pass num is :3 no pass num is :02.32+82=114right!97*15=1455right!99-58=41right!76-66=10right!58+13=71right!37+49=86right!99+52=151right!49*69=5462wrong!73-38=31wrong!86+34=120right!mark is 80四. 主要错误改正方法1.在本题的编写过程中常出现begin 和end 不配对,只要始它们的个数相同就可以了,就可以了。在程序中常出现的’unknown identifier’没有定义的错误,只要在程序前加上定义,就可以了。还有就是type mismatch’的类型不匹配,只要根据前后内容,重新定义,就可以了。2.在本题编写中,题目要求是两个两位数运算,如果写成c:=random(100)在运行过程中,就会出现一位数运算,只要把它写成c:=random(90)+10,就可以了。五. 实习小结1.第一题的程序编写比较复杂,需要较多的定义,因而在后面的程序部分,就常出现标识符重复,而导致的类型不匹配。还有就是每个部分编好后,上下不能连接,而无法调用。2.第二题较第一题简单,和书上的例题类似,所以,比较简单,但从中也出现一些不问题。以上两大题中出现的问题,要在同学的帮助下,才能完成。总的来说两题程序比较困难六. 程序清单ram twins;const m=3; n=3 ;typestudent=recordnum:integer;name:string[3];age:integer;sex:char;s:array[1..n] of real;math,eng,phy:real;ave:real;end;sarr=array[1..m] of student;ta=array [1..m] of student;f=string[6];varstu:sarr; ct:ta; k,d:integer;procedure readin (var stu:sarr);const wrong='0<=data<=100 ,again!';var j,i:integer; a:student;beginwriteln;writeln('Input ',m,' num name sex math phy eng',' of student.');for j:=1 to m dobeginwriteln;writeln('Input the ',j,' student :');with a dobeginwrite('num:'); readln(num);write('name:'); readln(name);write('age:'); readln(age);write('sex:'); readln(sex);while (sex<>'m')and(sex<>'f') dobeginwrite('sex:'); readln(sex)end;for i:=1 to n do begincase i of1:begin write('math:'); readln(s[i]);while(s[i]<0)or(s[i]>100)dobeginwriteln(wrong);write('math:'); readln(s[i]);end;end;2:begin write('phy:'); readln(s[i]);while(s[i]<0)or(s[i]>100)dobeginwriteln(wrong);write('phy:'); readln(s[i]);end;end;3:begin write('eng:'); readln(s[i]);while(s[i]<0)or(s[i]>100)dobeginwriteln(wrong);write('eng:'); readln(s[i]);end;end;end;end;stu[j]:=a;end;writeln;end;end;procedure ave (var stu:sarr);var j,i:integer; k:real;beginfor j:=1 to m dobegink:=0;with stu[j] dobeginfor i:=1 to n do k:=k+s[i];ave:=k/nend;end;end;procedure px (var stu:sarr);var tm:ta; j,i,p:integer;beginfor j:=1 to m dobeginp:=j;for i:=j+1 to m doif stu[i]>stu[p] then p:=i;tm[1]:=stu[p]; stu[p]:=stu[j]; stu[j]:=tm[1];end;end;procedure head (ct:ta);var i:integer;beginwrite(' '); for i:=1 to 72 do write('-');writeln;write('',' num':4,' ','name':9,' ','age':8,' ','sex':5,' ','math':6,' ','phy':9,' ','eng':8,' ');writeln('ave':6,' ');write(' '); for i:=1 to 72 do write('-');writeln;with ct[1] dobeginwrite('',num:7,' ',name:8,' ',age:8,' ',sex:5,' ');for i:=1 to n do write(s[i]:7,' ');write(ave:10,' ');writeln;end;write(' '); for i:=1 to 72 do write('-');writeln;end;procedure find (var stu:sarr);var n,i:integer; u:boolean;beginu:=true;while u dobeginwrite('Into number:');readln(n);for i:=1 to m dobeginif stu[i]=n then beginct[1]:=stu[i];u:=false;d:=iend;end;end;end;procedure del (var stu:sarr);var i:integer; b:char;beginhead(ct);write('true? Y/N'); readln(b);if b='y' then begin write('1');with stu[d] dobeginnum:=0; name:='0'; age:=0; sex:='f';for i:=1 to n do s[i]:=0;ave:=0end;endelseend;procedure tj (var stu:sarr);var w1,q1,q2,num,j:integer;h1,h2,h3:boolean;beginh1:=false;h2:=false;h3:=false;q1:=0;q2:=0;writeln(' ':30,'t the math t the phy t the eng ');readln(w1);case w1 of1:h1:=true;2:h2:=true;3:h3:=true;end;if h1 thenbeginbeginfor j:=1 to m dowith stu[j] doif stu[j]>=60 thenq1:=q1+1elseq2:=q2+1;writeln('math:');end;if h2 thenbeginbeginfor j:=1 to m dowith stu[j] doif stu[j]>=60 thenq1:=q1+1elseq2:=q2+1;writeln('phy:');end;if h3 thenbeginbeginfor j:=1 to m dowith stu[j] doif stu[j]>=60 thenq1:=q1+1elseq2:=q2+1;writeln('eng:');end;end;end;end;writeln(' ':5,'pass num is :',q1);writeln(' ':5,'no pass num is :',q2);end;procedure head1 (var stu:sarr);var j,i:integer;beginwriteln('---------------- table--------------':60);writeln;write(' '); for i:=1 to 72 do write('-');writeln;write('',' num':4,' ','name':9,' ','age':8,' ','sex':5,' ','math':6,' ','phy':9,' ','eng':8,' ');writeln('ave':6,' ');write(' '); for i:=1 to 72 do write('-');writeln;for j:=1 to m do beginwith stu[j] dobeginwrite('',num:7,' ',name:8,' ',age:8,' ',sex:5,' ');for i:=1 to n do write(s[i]:7:1,' ');write(ave:10:1,' ');writeln;end;write(' '); for i:=1 to 72 do write('-');writeln;end;end;beginreadin(stu);ave(stu);k:=0;while k<>5 dobeginwriteln('in s ');read(k); readln;while (k<>1)and(k<>2)and(k<>3)and(k<>4)and(k<>5) dobeginwriteln(' mistake,Please again');read(k)end;case k of1: begin px(stu); head1(stu) end;2: begin find(stu); head(ct) end;3: begin find(stu); del(stu); px(stu); head1(stu) end;4: begin tj(stu); end;5: writeln('exit!');end;end;ram shadow;var a,b,c,d,e:integer;right:boolean;procedure s1;beginwriteln('right!');right:=trueend;procedure s2;beginwriteln('wrong!');right:=falseend;procedure s3 (x,y:integer);var h:integer;beginwrite(x,'+',y,'=');readln(h);if h=x+y then s1else s2 end;procedure s4 (x,y:integer);var h,w:integer;beginif x<y thenbegin w:=x; x:=y; y:=wend;write(x,'-',y,'=');readln(h);if h=x-y then s1 else s2end;procedure s5 (x,y:integer);var h:integer;beginwrite(x,'*',y,'=');readln(h);if h=x*y then s1 else s2end;beginrandomize;e:=0;for a:=1 to 10 dobeginc:=random(90)+10;d:=random(90)+10;b:=random(3);case b of0:s3(c,d);1:s4(c,d);2:s5(c,d);end;if right then e:=e+10;end;writeln('mark is',e:3)end.

上机实验报告

实习自我鉴定
实习心得体会
实习报告题目
实习报告
实习报告格式
实习单位意见
实习计划
实习目的