看一下出什么问题了?
Project17.rar
(6.95 KB)
源代码:
#include<iostream>
#include <algorithm>
#include <vector>
#include <memory>
using namespace std;
int main()
{
const float i = 1.1;
cout << "求最大数,作者:万致远 版本" << i << endl;
int n, max, b;
cout << "有几个数";
cin >> n;
if (n < 2)
{
cout << "请尊重程序员,谢谢" << endl;
;
system("pause");
system("cls");
return 1;
}
vector<double> a(n);
for (b = 0; b < n; b++)
{
cout << "请输入第" << b + 1 << "个数";
cin >> a[b];
}
max = a[0];
for (size_t b = 1; b < n; b++)
{
if (a[b] > max)
{
max = a[b];
}
}
cout << "最大的数是" << max;
return 0;
}
编译正确,运行也很好,到可执行程序就不行了