亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

新手求大神幫忙debug:指針變量作為參數簡單應用

新手求大神幫忙debug:指針變量作為參數簡單應用

C C++
藏寶alo 2016-05-14 19:45:08
//要求錄入學號及對應的分數,找到最高分數,輸出最高分數及對應的學號#include <stdio.h>#define N 80int main(){ int n; int score[N];//分數? int number[N];//學號? int maxNum,maxScore; printf("Input:how many students in the class:\n"); scanf("%d",&n); printf("Input:the student number and the score"); int i; for(i=0;i<n;i++){ scanf("%d %d",&number[i],&score[i]); }//輸入學號及對應的分數? findMax(&maxScore,&maxNum,n,number[],score[]); printf("maxNum=%d,maxScore=%d",*maxNum,*maxNum); return 0;}//定義函數:尋找最大分數?void findMax(int* maxScore,int* maxNum,int n,int number[],int score[]){ *maxScore=score[0]; *maxNum=number[0]; int i; for(i=1;i<n;i=++){ if(score[i]>*maxScore){ *maxScore=score[i]; *maxNum=number[i]; } } }
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1630 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號