#include <stdio.h> #include <stdlib.h> int ReadScore(long num[],int
score[]);//从键盘录入学生学号和成绩 int LinSearch(long num[], long x, int n);//线性查找 int
ReadScore(long num[],int score[]) { int i = -1; do{ i++; printf("Input
num,score:"); scanf("%ld%d", &num[i], &score[i]); }while (score[i] >= 0);
return i; } int LinSearch(long num[], long x, int n) { int i; for (i=0; i<n;
i++) { if (num[i] == x) { return i; } } return -1; } int main() {//查找某学号学生成绩
int score[N], n, pos; long num[N], x; n = ReadScore(num, score); printf("Input
the searching ID:"); scanf("%ld", &x); pos = LinSearch(num, x, n); if (pos !=
-1) { printf("score=%d\n", score[pos]); } else { printf("Not found!\n"); }
system("pause"); return 0; }

技术
©2019-2020 Toolsou All rights reserved,
Java开发2020年最新常见面试题整理【Spring源码分析】42-@Conditional详解element-ui踩坑记录神仙面试宝典你有了吗?半月看完25大专题,居然斩获阿里P8offer使用css样式设计一个简单的html登陆界面XCTF攻防世界web新手练习_ 9_command_executionJS中的解构赋值的详解与具体用途Python Web 框架elementui 穿梭框 el-transfer 展示列表内容文字过长ConcurrentHashMap实现原理及源码解析