使用cnnic证书的网站,免费下载app软件安装,wordpress4.9.8安装,wordpress dnsprefetch从键盘输入某班学生某门课的成绩#xff08;每班人数最多不超过40人#xff09;#xff0c;当输入为负值时#xff0c;表示输入结束#xff0c;试编程从键盘任意输入一个学号#xff0c;查找该学号学生的成绩。**输入格式要求#xff1a;%ld(学号) %l…从键盘输入某班学生某门课的成绩每班人数最多不超过40人当输入为负值时表示输入结束试编程从键盘任意输入一个学号查找该学号学生的成绩。**输入格式要求%ld(学号) %ld%d 提示信息Total students are %d\n Input the searching ID: Input student’s ID and score: **输出格式要求score %d\n Not found!\n程序的两次运行示例如下① Input student’s ID and score:070310122 84Input student’s ID and score:070310123 83Input student’s ID and score:070310124 88Input student’s ID and score:070310125 87Input student’s ID and score:070310126 61Input student’s ID and score:-1 -1Total students are 5Input the searching ID:070310123score 83② Input student’s ID and score:070310122 84Input student’s ID and score:070310123 83Input student’s ID and score:070310124 88Input student’s ID and score:070310125 87Input student’s ID and score:070310126 61Input student’s ID and score:-1 -1Total students are 5Input the searching ID:070310128Not found!#includestdio.h
#define N 40
int main()
{int a[N], b[N], i, j, sum 0, score;long int id;for (i 0; i N; i){printf(Input student’s ID and score:);scanf(%ld%d, a[i], b[i]);if (a[i] 0 || b[i] 0)break;sum;}printf(Total students are %d\n , sum);printf(Input the searching ID:);scanf(%ld, j);i 0;for (i 0; i N; i){if (a[i] j i sum){printf(score %d\n, b[i]);break;}else if(i sum){printf(Not found!\n);break;} }return 0;
}