Advertisement
kiraventom

Untitled

Nov 20th, 2019
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int positivesCount = 0, negativesCount = 0;
  6.     int n;
  7.     std::cout << "Вводите числа:" << std::endl;
  8.     do
  9.     {
  10.         std::cin >> n;
  11.         if (n > 0){
  12.             ++positivesCount;
  13.         }
  14.         if (n < 0){
  15.             ++negativesCount;
  16.         }
  17.     }
  18.     while (n != 0);
  19.     std::cout << "Было введено " << positivesCount << " положительных и " << negativesCount << " отрицательных чисел.";
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement