听说教务处查不了绩点了,学过编程的文科生心里痒痒
用turbo pascal 7.0编了个程,
求各位软件计算机大佬批评指正。
program JIDIANJISUAN;
type
arrtype1=array[1..1000]of integer;
arrtype2=array[1..1000]of real;
var
GPA:real;
Chongkao,Guake:arrtype1;
Xuefen,Chengji,GPAn:arrtype2;
a,b,c,d,e,f,g,h,i,j:integer;
x,x1,y,z,z1:integer;
den,num:real;
begin
writeln('Welcome to use GPA calculator, please follow the instructions.');
writeln('And,"You"=95,"Liang"=85,"Zhong"=75,"Jige"=65,"Bujige"=0,"Hege"=80,"Buhege"=0');
writeln('If you failed a course and attended to a make-up examination,');
writeln('then the grade is 0, and the number of re examinations is 2');
for x:=1 to 1000 do
Chongkao[X]:=1;
x1:=1;
writeln('Please input the number of your courses in the first semester:');
readln(a);
if a>0 then
for x:=1 to a do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[z1]);
Chongkao[Guake[z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the second semester:');
readln(b);
if b>0 then
for x:=a+1 to a+b do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+1+z1]);
Chongkao[Guake[a+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the third semester:');
readln(c);
if c>0 then
for x:=a+b+1 to a+b+c do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+1+z1]);
Chongkao[Guake[a+b+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the fourth semester:');
readln(d);
if d>0 then
for x:=a+b+c+1 to a+b+c+d do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+1+z1]);
Chongkao[Guake[a+b+c+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the fifth semester:');
readln(e);
if e>0 then
for x:=a+b+c+d+1 to a+b+c+d+e do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+1+z1]);
Chongkao[Guake[a+b+c+d+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the sixth semester:');
readln(f);
if f>0 then
for x:=a+b+c+d+e+1 to a+b+c+d+e+f do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+e+1+z1]);
Chongkao[Guake[a+b+c+d+e+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the seventh semester:');
readln(g);
if g>0 then
for x:=a+b+c+d+e+f+1 to a+b+c+d+e+f+g do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+e+f+1+z1]);
Chongkao[Guake[a+b+c+d+e+f+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the eighth semester:');
readln(h);
if h>0 then
for x:=a+b+c+d+e+f+g+1 to a+b+c+d+e+f+g+h do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+e+f+g+1+z1]);
Chongkao[Guake[a+b+c+d+e+f+g+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the ninth semester:');
readln(i);
if i>0 then
for x:=a+b+c+d+e+f+g+h+1 to a+b+c+d+e+f+g+h+i do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+e+f+g+h+1+z1]);
Chongkao[Guake[a+b+c+d+e+f+g+h+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the tenth semester:');
readln(j);
if j>0 then
for x:=a+b+c+d+e+f+g+h+i+1 to a+b+c+d+e+f+g+h+i+j do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+e+f+g+h+i+1+z1]);
Chongkao[Guake[a+b+c+d+e+f+g+h+i+1+z1]]:=2;
end;
end;
den:=0;
num:=0;
for y:=1 to x do
begin
GPAn[y]:=Chengji[y]/10-5;
end;
for y:=1 to x do
den:=den+Xuefen[y]*Chongkao[y];
for y:=1 to x do
num:=num+GPAn[y]*Xuefen[y];
GPA:=num/den;
writeln('Your GPA is:',GPA:6:6);
readln;
end.
用turbo pascal 7.0编了个程,
求各位软件计算机大佬批评指正。
program JIDIANJISUAN;
type
arrtype1=array[1..1000]of integer;
arrtype2=array[1..1000]of real;
var
GPA:real;
Chongkao,Guake:arrtype1;
Xuefen,Chengji,GPAn:arrtype2;
a,b,c,d,e,f,g,h,i,j:integer;
x,x1,y,z,z1:integer;
den,num:real;
begin
writeln('Welcome to use GPA calculator, please follow the instructions.');
writeln('And,"You"=95,"Liang"=85,"Zhong"=75,"Jige"=65,"Bujige"=0,"Hege"=80,"Buhege"=0');
writeln('If you failed a course and attended to a make-up examination,');
writeln('then the grade is 0, and the number of re examinations is 2');
for x:=1 to 1000 do
Chongkao[X]:=1;
x1:=1;
writeln('Please input the number of your courses in the first semester:');
readln(a);
if a>0 then
for x:=1 to a do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[z1]);
Chongkao[Guake[z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the second semester:');
readln(b);
if b>0 then
for x:=a+1 to a+b do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+1+z1]);
Chongkao[Guake[a+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the third semester:');
readln(c);
if c>0 then
for x:=a+b+1 to a+b+c do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+1+z1]);
Chongkao[Guake[a+b+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the fourth semester:');
readln(d);
if d>0 then
for x:=a+b+c+1 to a+b+c+d do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+1+z1]);
Chongkao[Guake[a+b+c+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the fifth semester:');
readln(e);
if e>0 then
for x:=a+b+c+d+1 to a+b+c+d+e do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+1+z1]);
Chongkao[Guake[a+b+c+d+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the sixth semester:');
readln(f);
if f>0 then
for x:=a+b+c+d+e+1 to a+b+c+d+e+f do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+e+1+z1]);
Chongkao[Guake[a+b+c+d+e+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the seventh semester:');
readln(g);
if g>0 then
for x:=a+b+c+d+e+f+1 to a+b+c+d+e+f+g do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+e+f+1+z1]);
Chongkao[Guake[a+b+c+d+e+f+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the eighth semester:');
readln(h);
if h>0 then
for x:=a+b+c+d+e+f+g+1 to a+b+c+d+e+f+g+h do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+e+f+g+1+z1]);
Chongkao[Guake[a+b+c+d+e+f+g+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the ninth semester:');
readln(i);
if i>0 then
for x:=a+b+c+d+e+f+g+h+1 to a+b+c+d+e+f+g+h+i do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+e+f+g+h+1+z1]);
Chongkao[Guake[a+b+c+d+e+f+g+h+1+z1]]:=2;
end;
end;
x1:=1;
writeln('Please input the number of your courses in the tenth semester:');
readln(j);
if j>0 then
for x:=a+b+c+d+e+f+g+h+i+1 to a+b+c+d+e+f+g+h+i+j do
begin
writeln('Please input the grade, point of course',x1);
readln(Chengji[x],Xuefen[x]);
inc(x1);
end;
writeln('If you failed some courses, please input the number,if not, please input 0:');
readln(z);
if z>0 then
begin
writeln('please input each order number of your failed course and press Enter:');
for z1:=1 to z do
begin
readln(Guake[a+b+c+d+e+f+g+h+i+1+z1]);
Chongkao[Guake[a+b+c+d+e+f+g+h+i+1+z1]]:=2;
end;
end;
den:=0;
num:=0;
for y:=1 to x do
begin
GPAn[y]:=Chengji[y]/10-5;
end;
for y:=1 to x do
den:=den+Xuefen[y]*Chongkao[y];
for y:=1 to x do
num:=num+GPAn[y]*Xuefen[y];
GPA:=num/den;
writeln('Your GPA is:',GPA:6:6);
readln;
end.