#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter n: ";
cin >> n;
float* Arr;
Arr = new float[n];
cout << "Array:" << endl;
for (int i = 0; i < n; i++) cin >> *(Arr + i);
int count_pos = 0, count_neg = 0, count_zer = 0;
for (int i = 0; i < n; i++)
{
if (Arr[i] < 0)
count_neg++;
if (Arr[i] > 0)
count_pos++;
if (Arr[i] == 0)
count_zer++;
}
cout << "the number of negative: " << count_neg << endl;
cout << "the number of positive: " << count_pos << endl;
cout << "the number of zero: " << count_zer << endl;
delete[] Arr;
getchar();
getchar();
return 0;
}
Перед публікацією, радимо ознайомиться з правилами!
Знайшли помилку?
Ви можете повідомити про це адміністрацію.
Виділіть текст і натисніть CTRL+Enter