pascal鍵盤輸入數,判斷該數的等級

時間 2022-05-15 15:15:13

1樓:pascal真人

vara:longint;

begin

readln(a);

case a of:

0..59:write('d');

60..74:write('c');

75..84:write('b');

85..100:write('a');

end;

end.

其實就那麼簡單,思考吧,祝你學習愉快!

2樓:匿名使用者

var score:real;

begin

readln(score);

if (score>=85)and(score<=100)writeln('a')

else if (score>=75)and(score<85)writeln('b')

else if (score>=60)and(score<75)writeln('c')

else if (score>=0)and(score<60)writeln('d');

end.

因為沒說分數是整數,而且現實生活中有60.5分這樣的例子。所以使用了real.

C 定義陣列,從鍵盤上輸入數,每輸入數,都讓該陣列中所有元素保持排序狀態

可以使用stl中的set,也可以是multiset,不過你應該去學習這個結構的原理,可以學學平衡樹,這個還可以用堆排序實現,不斷維持一個小根堆或大根堆便是。你可以去搜堆排序,我給你個set的例子 include include include using namespace std int main...

程式設計從鍵盤輸入三位數,將它們逆序輸出。如輸入123,輸出321 謝謝

墨汁諾 void main int x,a,b,c cin x a x 100 b x 10 10 c x 10 cout 例如 include int main int a,b,c,t scanf d a b a 10 c a b 100 t a 100 printf b dc dt d b,c,...

彙編程式題 從鍵盤輸入0 9中任一自然數X,求其立方值

x86彙編 求0 9立方,顯示結果 masm5.0編譯後,執行無誤 code segment assume cs code,ds codeorg 100h start push cs pop ds again lea dx,tips1 mov ah,9 int 21h 顯示提示 in mov ah,...