</pre><pre name="code" class="cpp"><p>#include <iostream></p>using namespace std;
const int a = 1001;
int str[a];
int main()
{
int n=0;
for(int i=1;i<=a;++i)
{
cin >> str[i];
n+=1;
}
if(str[1]<str[2])
{
int m;
m = str[2];
str[1] = m;
}
for(int b=3;b<=n;++b)
{
if(str[1]<str[b])
{
int k;
k = str[b];
str[1] = k;
}
}
int g = str[1];
cout << g << endl;
return 0;
}
这是一个在数组中求最大数的问题大数的问题并给出所在位置,但输出结果有点怪
输入完数组后必须再打一个字母
如输入:5 9 4 7 3 74 w
输出 :74 1001