习题8(8.6)
来源:互联网 发布:工业设计软件图标 编辑:程序博客网 时间:2024/06/05 21:58
#include <stdlib.h>#define N 40int ReadScore(int a[],long num[]);int FindMax(int a[],long num[],int n,int *pmaxs,int *pmaxn);int main(){ int n,pmaxs,pmaxn; int a[N]; long num[N]; n=ReadScore(a,num); printf("%d\n",n); FindMax(a,num,n,&pmaxs,&pmaxn); printf("%d %d\n",pmaxs,pmaxn); return 0;}int ReadScore(int a[],long num[]){ int i=-1; do{ i++; printf("输入成绩和学号:"); scanf("%d%ld",&a[i],&num[i]); }while(a[i]>=0&&num[i]>=0); return i;}int FindMax(int a[],long num[],int n,int *pmaxs,int *pmaxn){ int i; *pmaxs=a[0]; *pmaxn=num[0]; for(i=0;i<n;i++) { if(a[i]>*pmaxs) { *pmaxs=a[i]; *pmaxn=num[i]; } }}
知识点:函数调用与数组和指针的运用
阅读全文
0 0
- 习题8(8.6)
- 习题8(8.4)
- 习题8(8.5)
- 机器学习习题(8)
- 习题8.6
- 习题8.6
- 习题8
- 习题8
- 习题8
- 习题8
- 《c++primer(第四版)》习题8.6
- (第二次作业)习题5-8
- 习题5-8(第二次作业)
- 习题8-1:装箱(贪心)
- 双向链表习题(牛客网习题)
- 内部类习题8
- 习题1-8,绝对值
- 习题2—8
- 从SVN导出工程,在Eclipse中没有build path或build path 灰色不可编辑
- 《高性能MySQL》之查询性能优化
- 阿里云远程连接服务器出错
- CF 122A- Lucky Division
- 单片机实验5
- 习题8(8.6)
- input合并
- 找出旋转数组的最小的元素
- Android开发学习之路--NDK、JNI之初体验
- android boot image格式分析
- Win7命令终端基础配色指南
- unity cardboard 导出
- MFC常用API
- CGI、fastCGI、php-fpm都是什么?其工作原理流程是怎样的?