Quipex

zadanie_5_XIII

Oct 22nd, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. // zadanie_5_XIII.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int k;
  11.     cin>>k;
  12.     double *mas;
  13.     mas = new double[k];
  14.     int i;
  15.     bool poloj,poloj2,block=false;
  16.     cout<<"["<<0<<"]=";
  17.     cin>>mas[0];
  18.     if(mas[0]>=0)
  19.         poloj=true;
  20.     else
  21.         poloj=false;
  22.     for(i=1;i<k;i++)
  23.     {
  24.         cout<<"["<<i<<"]=";
  25.         cin>>mas[i];
  26.         if(mas[i]>=0)
  27.             poloj2=true;
  28.         else
  29.             poloj2=false;
  30.         if(poloj==poloj2)
  31.             block=true;
  32.         else
  33.             poloj=poloj2;
  34.     }
  35.     if(block==true)
  36.         cout<<"Ne znakocheredujushajasa\n";
  37.     else
  38.         cout<<"Znakocheredujushajasa\n";
  39.     system("pause");
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment