Advertisement
rorschack

c++ prac prog - 18

Aug 16th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream.h>
  2. #include <conio.h>
  3.  
  4. void main()
  5. {
  6.     clrscr();
  7.     int n,inp_p(0),inp_n(0),inp_0(0);
  8.     char inp;
  9.     do
  10.     {
  11.         cout << "\nEnter any number: ";
  12.         cin >> n;
  13.         if(n<0)
  14.             inp_n++;
  15.         else if(n>0)
  16.             inp_p++;
  17.         else
  18.             inp_0++;
  19.         cout << "\nEnter 'y' to enter again or 'n' to continue: ";
  20.         cin >> inp;
  21.     } while(inp=='y'||inp=='Y');
  22.     cout << "\n Of the entered nos.,\n\tNo. of positives are " << inp_p << "\n\tNo. of negatives are " << inp_n << "\n\tNo. of zeroes are " << inp_0 << endl;
  23.     getch();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement