С++. Вопрос, почему не работает цикл while. Вот код
#include
#include
#include
using namespace std;
int main()
{
const int size = 5;
double arr[size];
int nowi;
for (int i = 0; i < size; i++)
{
cin >> arr[i];
}
cout << endl;
int sum = 0;
int k = 0;
for (int i = 0; i < size; i++)
{
while (arr[i] < 0)
{
k++;
sum = sum + arr[i];
}
}
cout << k << endl << sum;
return 0;
}
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.