std::cout << "Please input a group of numbers : "<< std::endl;
int a[5];
std::cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
int negative = 0;
for (int i = 0;i <= 5;i++) {
if (a[i] < 0)
negative += 1;
}
int a[5];
std::cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
int negative = 0;
for (int i = 0;i <= 5;i++) {
if (a[i] < 0)
negative += 1;
}
std::cout << "The numbers of the negative ones is: " << negative << std::endl;
为什么?虽然能运行出正确结果 但是会弹出如下: