rabbinur

Reverses order of numbers in input

Aug 14th, 2012
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. #include <iostream.h>
  2. #include <conio.h>
  3.  void main()
  4.  {
  5.   int a[5];
  6.   int n=0;
  7.   clrscr();
  8.   while(cin>>a[n]){
  9.   n++;
  10.   }
  11.   {
  12.    int i;
  13.    for(i=n-1; i>=0; i--)
  14.    cout<< a[i]<<endl;
  15.   }
  16.    getch();
  17. }
Advertisement
Add Comment
Please, Sign In to add comment