热门

最新

红包

立Flag

投票

同城

我的

发布
uihanuisdhdno
余生安稳
4 年前
trueuihanuisdhdno

怎么改成动态1234

你问我答
CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
取数组中最大值,这样输出是对的,但是如果删去cout <<score[5] 输出的就不对,为什么呢?输出的是不是地址?#include <iostream>using namespace std;int getmax(int arr[]){ int i = 0; int max = 0; max = arr[0]; for (i = 0; i < 16; i++) { if (arr[i] > max) { max = arr[i]; } } return max;}int main() { int n = 0; int scores[] = { 16,15,85,89,79,78,99,100,85,97,87 }; n = sizeof(scores) / sizeof(int); cout << "学生数:" << n << endl; cout << getmax(scores); cout << scores[5]; return 0;}
立即登录