Facebook
From Walloping Lechwe, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 238
  1. #include <iostream>
  2. #include <fstream>
  3. #include <conio.h>
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5. using namespace std;
  6. ifstream plik("tablice.txt");
  7. ofstream wynik("wynik.txt");
  8. void odw(int t[],int y)
  9. {
  10.         for(int i=y-1;i>=0;i--)
  11.                 {
  12.                         wynik<<t[i]<<" ";
  13.                         cout<<t[i]<<" ";
  14.                 }
  15.         wynik<<endl<<"***************************************************"<<endl;
  16.         wynik<<endl;
  17.         cout<<endl<<"***************************************************"<<endl;
  18.         cout<<endl;
  19. }  
  20. int main(int argc, char** argv) {
  21.         int ile_ciagow, x,y;
  22.         int tab[99];
  23.         plik>>x;
  24.         while(!plik.eof())
  25.         {
  26.                 plik>>y;
  27.                 for(int i=0;i<y;i++)
  28.                 {
  29.                 plik>>tab[i];  
  30.                 cout<<tab[i]<<" ";      
  31.                 wynik<<tab[i]<<" ";
  32.                 }
  33.                 cout<<endl;
  34.                 wynik<<endl;
  35.                 odw(tab,y);
  36.         }
  37.         plik.close();
  38.         wynik.close();
  39.         return 0;
  40. }
  41.