當前位置:首頁 » 考試成績 » 輸入一個學生的成績輸出其等級

輸入一個學生的成績輸出其等級

發布時間: 2020-12-07 00:08:26

㈠ 編寫程序:  設成績分為五個等級,編寫程序,從鍵盤輸入一個學生的成績, 輸出對應的等級。

#include<stdio.h>
main()
{
int a;
Scanf("%d,&a);
Switch(a/10)
{
Case 10:printf("A\n");break;
Case 9:printf("B\n");break;
Case 8:printf("C\n");break;
Case 7:printf("D\n");break;
Case 6:printf("E\n");break;
default:printf("F\n");
}
}

㈡ 編程問題:輸入一個學生的百分製成績,然後按此輸出等級:90~~100為「優秀」,70~~89為「良

這個是比較容易抄的,主要襲是根據數值輸出相應的內容就可以了。

#include<stdio.h>

intmain()
{
floatscore;
printf("請輸入學生成績(百分制):");
scanf("%f",&score);

if(score>=90&&score<=100)
printf("優秀 ");
elseif(score>=70&&score<90)
printf("良好 ");
elseif(score>=60&&score<70)
printf("良好 ");
elseif(score<60)
printf("不及格 ");
else
printf("無效的成績 ");//0到100以外的無效數值
}

㈢ C++編程題:輸入10個學生的姓名、學號和成績,輸出學生的成績等級和不及格人數。

#include<iostream>

#include<string>

using namespace std;

const int n=10;

string name[n]; //定義姓名數組

int num[n],score[n]; //定義學號和成績數組

int main()

{int i;

void input_data();

int_data();

cout<<endl<<"不及格名單:版"<<endl;

for(i=0;i<n;i++)

if(score[i]<60)

cout<<"name[i]"<<" "<<"num[i]"<<" "<<score[i]<<endl;

return 0;

}


viod input_data()

{int i;

for(i=0;i<n;i++)

{cout<<"請輸入學生的姓名、學權號和成績"<<i+1<<":";

cin>>name[i]>>num[i]>>score[i];


}

return 0;

}

㈣ c++中用switch語句編程;輸入百分制的一個學生成績,然後按優.良.中.及格.不及格.等級制,輸出對應%

#include<stdio.h>
void main()
{
int score=0;
int grade=0;
printf("成績(0-100)\n");

scanf("%d",&score); //鍵盤輸入學生成績
while(score>=0&&score<=100)
{
grade=score/10;
switch(grade)
{
case 10:
case 9:
printf("優");
break;
case 8:
printf("良");
break;
case 7:
printf("中");
break;
case 6:
printf("及格");
break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:
printf("不及格");
break;
}
scanf("%d",&score); //鍵盤輸入下一個學生成績
}
printf("輸入錯誤!");
}
這個程序可一連續輸入成績,直道你輸入0-100之外的數就會結束程序的運行!

㈤ 輸入一個百分製成績,要求輸出成績等級A、B、C、D、E。用matlab來做

#include<stdio.h>

int main()

{

int score;

printf("輸入學生的成績: ");

scanf("%d",&score);

if (score<0 || score>100)

{

printf("輸入的數據非法! ");

}

else

{

switch(score/10)

{

case 0:

case 1:

case 2:

case 3:

case 4:

case 5:printf("該同學的等級為:E ");break;

case 6:printf("該同學的等級為:D ");break;

case 7:printf("該同學的等級為:C ");break;

case 8:printf("該同學的等級為:B ");break;

case 9:

case 10:printf("該同學的等級為:A ");break;

}

}

return 0;

}

(5)輸入一個學生的成績輸出其等級擴展閱讀:

matlab的輸入與輸出

輸出語句就是一個非常簡單的,disp(『yes, of course』)

這樣的話就能輸出yes, of course

如果想要輸出變數就輸出變數名即可 disp(變數名)

關於輸入:

輸入沒啥好說的,就是input

比如說:input(『please input an integer』)

這樣的話就會輸出一句:please input an integer,然後你就能輸進去一個數值

同時要說的是,input也是有返回值的,可以返回數或者字元串兩種類型,而數是已經默認好了的,而字元串是沒有默認的,需要自己去聲明,舉個例子

x = input(『yes ,of course』); 可以返回一個數

x = input(『please input an string』,』s』); 返回一個字元串

給出Matlab中的詳細操作

input('such an instance');

x = input('please input an integer');

x = input('please input an string','s');

disp('中文無敵的');

disp(x);

㈥ 輸入一個學生的成績,若是合法成績,則輸出相應的等級,否則輸出不合法的提示信息。

80<=a<90這種寫法錯了。
應寫成a>=80 && a<90
以此類推。

㈦ 使用嵌套的If,else,end if 語句編寫一個求成績等級的程序,要求輸入一個學生的成績,輸出其分數和對應...

Private Sub Command1_Click()
x = Val(InputBox("請輸入抄一門襲功課的成績:"))
If x >= 85 Then
cj = "A"
Else
If x >= 75 Then
cj = "B"
Else
If x >= 60 Then
cj = "C"
Else
If x >= 50 Then
cj = "D"
Else
cj = "E"
End If
End If
End If
End If
MsgBox (x & "分==>" & cj)
End Sub

㈧ javascript根據學生考試成績,輸出其總評的級別。

<!doctypehtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>Demo</title>
<script>

//試著編寫一個程序,根據學生考試成績,輸出其總評的級別
varrank=function(n){

varrules={

59:'不及格',
69:'一般',
79:'中等',
89:'良好',
100:'優秀'
};

n=Number(n);
n=(isNaN(n)||n<0)?0:n;
n=n>100?100:n;

for(varlimitinrules){

if(n<=limit)
returnrules[limit];
}

return'outofrules!';

};

//輸入1-7中的任何一個數字,輸出相應的星期
varweek=function(n){

return{

1:'星期一',
2:'星期二',
3:'星期三',
4:'星期四',
5:'星期五',
6:'星期六',
7:'星期日'

}[n]||'outofrules!';
};

//輸入1-12中的任何一個數字,輸出相應的季節
varseason=function(n){

varrules={

3:'春',
6:'夏',
9:'秋',
12:'冬'
};

n=Number(n);
n=(isNaN(n)||n<1)?1:n;
n=n>12?12:n;

for(varlimitinrules){

if(n<=limit)
returnrules[limit];
}

return'outofrules!';
};

//定義一個無參數無返回值的名稱為sayHello的函數,其作用是彈出提示框並提示信息「Hello,welcomeyou!」;
varsayHello=function(){

alert('Hello,welcomeyou!');

};

//定義一個函數名稱為cube,其作用是彈出輸入框提示用戶輸入一個整數(其方法是parseInt(prompt("請輸入整數",0))),計算該整數的立方,並彈出提示框提示計算的結果
varcube=function(){

varn=parseInt(prompt('請輸入整數',0));

alert(Math.pow(n,3));

};

//定義一個函數名稱為opt,其作用是計算1到n之間所有整數之和,將結果作為函數返回值返回
varopt=function(n){

varsum=0;
for(vari=1;i<=n;i++)
sum+=i;
returnsum;

};



window.addEventListener('load',function(){

//調用函數sayHello()
sayHello();
//調用函數cube(),並輸入整數25,查看計算結果
cube();
//調用函數opt(),計算1到20之間所有整數的和,並使用document.write()方法輸出計算結果
document.write(opt(20));

});

</script>
</head>
<body>

</body>
</html>

㈨ C語言:輸入一個正整數n,再輸入n個學生的百分製成績,統計各等級成績的個數。

#include <stdio.h>

int main(int argc, char *argv[])

{

int count,i,sum=0,avg;

int score[20];

int count_A=0,count_B=0,count_C=0,count_D=0,count_E=0;

printf("你要輸入幾個學生的成績:");

scanf("%d",&count);

printf("請輸入%d個學生的成績 ",count);

for(i=0;i<count;i++){

scanf("%d",&score[i]);

}

for(i=0;i<count;i++){

sum+=score[i];

}

avg=sum/count;

for(i=0;i<count;i++){

if(score[i]<=100&score[i]>=90) count_A++;

else if(score[i]<90&score[i]>=80) count_B++;

else if(score[i]<80&score[i]>=70) count_C++;

else if(score[i]<70&score[i]>=60) count_D++;

else if(score[i]<600&score[i]>=0) count_E++;

else {}

}

printf("A等的成績個數有:%d個 ",count_A);

printf("B等的成績個數有:%d個 ",count_B);

printf("C等的成績個數有:%d個 ",count_C);

printf("D等的成績個數有:%d個 ",count_D);

printf("E等的成績個數有:%d個 ",count_E);

getch();

}

這本書被 C語言開發者們稱為K&R,很多年來被當作 C語言的非正式的標准說明。人們稱這個版本的 C語言為K&R C。

(9)輸入一個學生的成績輸出其等級擴展閱讀

起初,C語言沒有官方標准。1978年由美國電話電報公司(AT&T)貝爾實驗室正式發表了C語言。布萊恩·柯林漢(Brian Kernighan) 和 丹尼斯·里奇(Dennis Ritchie) 出版了一本書,名叫《The C Programming Language》。

K&R C主要介紹了以下特色:

結構體(struct)類型

長整數(long int)類型

無符號整數(unsigned int)類型

把運算符=+和=-改為+=和-=。因為=+和=-會使得編譯器不知道使用者要處理i = -10還是i =- 10,使得處理上產生混淆。

即使在後來ANSI C標准被提出的許多年後,K&R C仍然是許多編譯器的最 准要求,許多老舊的編譯器仍然運行K&R C的標准。

㈩ C/C++輸入某學生成績,輸出其成績等級

|||#include <stdio.h> void main() { int grade; printf("input grade.\n"); scanf("%d",&grade); if (grade>100 || grade<0)/*1*/ printf("input error\n"); else switch(grade=grade/10){ /*2*/ { case 10: case 9:printf("A\n"); break; case 8:printf("B\n"); break; case 7: case 6:printf("C\n"); break; default:printf("D\n"); break; } printf("the grade is %d"); } 程序很正確哪有錯回?答

熱點內容
武漢大學學生會輔導員寄語 發布:2021-03-16 21:44:16 瀏覽:612
七年級學生作文輔導學案 發布:2021-03-16 21:42:09 瀏覽:1
不屑弟高考成績 發布:2021-03-16 21:40:59 瀏覽:754
大學畢業證會有成績單 發布:2021-03-16 21:40:07 瀏覽:756
2017信陽學院輔導員招聘名單 發布:2021-03-16 21:40:02 瀏覽:800
查詢重慶2018中考成績查詢 發布:2021-03-16 21:39:58 瀏覽:21
結業考試成績怎麼查詢 發布:2021-03-16 21:28:40 瀏覽:679
14中醫醫師資格筆試考試成績查分 發布:2021-03-16 21:28:39 瀏覽:655
名著賞析課程標准 發布:2021-03-16 21:27:57 瀏覽:881
北京大學商業領袖高端培訓課程 發布:2021-03-16 21:27:41 瀏覽:919