题目描述
给定 100 个整数,请你找出其中最大的数字,以及它的输入位置(位置从 1 开始)。
样例
22229
48558
24992
4755
11923
...
20213
在for循环中直接读取数字版
#include <iostream>
using namespace std;
int main(){
int input, count=1, max=0, place=0;
for (cin >> input; count <= 100; cin >> input) {
if(max < input){
max = input;
place = count;
}
count++;
}
cout << max << endl << place << endl;
return 0;
}