Advertisement
Guest User

Untitled

a guest
May 29th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     ifstream f("chenar.in");
  8.     ofstream g("chenar.out");
  9.  
  10.     int n,m, a[101][101],i,j,s,k,ok=1;
  11.     f>>n;
  12.  
  13.     for(i=1;i<=n;i++)
  14.     {
  15.         for(j=1;j<=n;j++)
  16.         {
  17.             f>>a[i][j];
  18.         }
  19.     }
  20.  
  21.  
  22.          for(j=1;j<=n-1;j++)
  23.          {
  24.              i=1;
  25.              g<<a[i][j]<<" ";
  26.          }
  27.          for(i=1;i<=n-1;i++)
  28.          {
  29.              j=n;
  30.              g<<a[i][j]<<" ";
  31.          }
  32.          for(j=n;j>=2;j--)
  33.          {
  34.              i=n;
  35.             g<<a[i][j]<<" ";
  36.          }
  37.          for(i=n;i>=2;i--)
  38.          {
  39.              j=1;
  40.               g<<a[i][j]<<" ";
  41.          }
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement