MATLAB switch输出百分制成绩输入一个百分制成绩,要求输出成绩等级,A,B,C,D,E.其中90-100分为A,80-89为B,70-79为C,60-69分为D,60分以下为E.performance=input('请输入百分制成绩');switch x(performance/10)case{0,1,2,3,4

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/27 23:24:55

MATLAB switch输出百分制成绩输入一个百分制成绩,要求输出成绩等级,A,B,C,D,E.其中90-100分为A,80-89为B,70-79为C,60-69分为D,60分以下为E.performance=input('请输入百分制成绩');switch x(performance/10)case{0,1,2,3,4
MATLAB switch输出百分制成绩
输入一个百分制成绩,要求输出成绩等级,A,B,C,D,E.其中90-100分为A,80-89为B,70-79为C,60-69分为D,60分以下为E.
performance=input('请输入百分制成绩');
switch x(performance/10)
case{0,1,2,3,4,5}
disp(E);
case{6}
disp(D);
case{7}
disp(C);
case{8}
disp(D);
case{9}
disp(A);
otherwise
disp(wrong);
end
这样为什么不对

MATLAB switch输出百分制成绩输入一个百分制成绩,要求输出成绩等级,A,B,C,D,E.其中90-100分为A,80-89为B,70-79为C,60-69分为D,60分以下为E.performance=input('请输入百分制成绩');switch x(performance/10)case{0,1,2,3,4
原代码的主要问题是disp() 里面的A、B等都是字符,需要加' ',
另外就是switch x(performance/10) 里的x不知道是什么.新写的命令如下:
————————————————————————————————————————
performance=input('请输入百分制成绩:');
if (performance>100) | (performance