有警报
运行/编译的时候总会现警报:>C:\Users\sz\source\repos\Project18\Project18\源.cpp(26,11): warning C4244: “=”: 从“_Ty”转换到“int”,可能丢失数据,有神马问题?#include<iostream>
#include<string>
#include <algorithm>
#include <vector>
#include <memory>
#include<windows.h>
using namespace std;
void da()
{
int n, max, b = 0, l = 1;
cout << "有几个数";
cin >> n;
if (n < 2)
{
cout << "请尊重程序员,谢谢" << endl;
system("pause");
system("cls");
}
vector<double> a(n);
for (b = 0; b < n; b++)
{
cout << "请输入第" << b + 1 << "个数";
cin >> a[b];
}
max = a[0];
for (b = 1; b < n; b++)
{
if (a[b] > max)
{
max = a[b];
l = b;
}
}
cout << "最"; Sleep(500); cout << "大"; Sleep(500); cout << "的"; Sleep(500); cout << "数"; Sleep(500); cout << "是"; Sleep(500); cout << max; Sleep(500); cout << "是"; Sleep(500); cout << "第"; Sleep(500); cout << ++l; Sleep(500); cout << "个"; Sleep(500);
while (true)
{
NULL;
}
}
void xiao()
{
int n, min, b = 0, l = 2;
cout << "有几个数";
cin >> n;
if (n < 2)
{
cout << "请尊重程序员,谢谢" << endl;
system("pause");
system("cls");
}
vector<double> a(n);
for (b = 0; b < n; b++)
{
cout << "请输入第" << b + 1 << "个数";
cin >> a[b];
}
min = a[0];
for (b = 1; b < n; b++)
{
if (a[b] < min)
{
min = a[b];
l = b;
}
}
cout << "最"; Sleep(500); cout << "小"; Sleep(500); cout << "的"; Sleep(500); cout << "数"; Sleep(500); cout << "是"; Sleep(500); cout << min;
while (true)
{
NULL;
}
}
int main()
{
const double i = 1.2;
cout << "正在加载中,请稍后。就一杯茶的功夫";
Sleep(100000);
cout << "求最大/小数,作者:万致远 版本" << i << endl;
string da_xiao;
cout << "求大?求小?";
cin >> da_xiao;
if (da_xiao=="大")
{
da();
}
else
{
if (da_xiao=="小")
{
xiao();
}
else
{
cout << "新功能正在开发中,或请更新版本";
}
}
}
[此贴子已经被作者于2020-4-9 09:56编辑过]