Advertisement
Mr_D3a1h

Untitled

Oct 13th, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "iostream"
  3. #include "iomanip"
  4. #include <iso646.h>
  5. using namespace std;
  6. int main()
  7. {
  8.     int m,n,i,j;
  9.     cout << "Введите n и m: \n";
  10.     cin >> n >> m;
  11.     string a[n][m];
  12.     for (i = 0; i< n; i++)
  13.         for (j = 0; j < m; j++)
  14.         {
  15.             if (i != 0 and i != n-1)
  16.             {
  17.                 a[i][0] = "*";
  18.                 a[i][m-1] = "*";
  19.             }
  20.             else
  21.                 a[i][j] = "*";
  22.            
  23.         }
  24.            
  25.     for (i=0; i<n; i++)
  26.     {
  27.            for (j=0; j<m; j++)
  28.            {
  29.                
  30.                    cout<<a[i][j]<<"\t";
  31.                
  32.            }
  33.            cout<<endl;
  34.     }
  35.        return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement