pascal编程方面的问题

来源:百度知道 编辑:UC知道 时间:2024/05/17 23:42:59
。输入一个分数根据下列分数指标,打印出成绩。90-100 A 80-89 B 70-79 C 60-69 D 50-59 E 0-49 F

使用CASE语句或IF语句 回答着请复详细程序,越详细,追加悬赏越高

An available example with "if":

program if_example;
var num:integer;
begin
writeln('Input a score:');
readln(num);
if num>100 then writeln('error!') else
if num>=90 then writeln('Got A') else
if num>=80 then writeln('Got B') else
if num>=70 then writeln('Got C') else
if num>=60 then writeln('Got D') eles
if num>=50 then writeln('Got E') else
if num>=0 then writeln('Got F') else
writeln('error!');
end.

An available instance with "case":

program case_example;
var num:integer;
begin
writeln('Input a score:');
readln(num);
if (num>=0)and(num<=100) then
case num of
0..49:writeln('Got F');
50..59:writeln('Got E');
60..69:writeln('Got D');
70..79:writeln('Got C');
80..89:writeln('