中文变量
#include<iostream>#include<string>
#include <algorithm>
#include <vector>
#include <memory>
using namespace std;
int da()
{
int n, max, b = 0, l = 2;
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 (b = 1; b < n; b++)
{
if (a[b] > max)
{
max = a[b];
l = b;
}
}
cout << "最大的数是" << max << "是第" << l + 1 << "个";
while (true)
{
NULL;
}
return 0;
}
int main()
{
const double i = 1.2;
cout << "求最大/小数,作者:万致远 版本" << i << endl;
char da_xiao;
cin >> da_xiao;
switch (da_xiao)
{
case '大':da(); break;
case '小':cout << "新功能正在开发中,请等待。"; break;
}
}char类型不能是中文,怎么办?