Advertisement
askarulytarlan

матрица

Oct 30th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #include <math.h>
  5.  
  6.  
  7. using namespace std;
  8.  
  9. int n;
  10. int a[100];
  11.  
  12. int main() {
  13.  
  14. cin >> n;
  15. for(int i = 1; i <= n*n; i++){
  16. cin >> a[i];
  17. }
  18. for(int i = 1; i <= n; i++){
  19. for(int j = 1; j <= n; j++){
  20. cout << " ---";
  21. }
  22. cout<<endl;
  23. for(int j = 1; j <= n; j++){
  24. cout << "| " << a[(i-1)*n+j] << " ";
  25. }
  26. cout << "|";
  27. cout << endl;
  28. }
  29. for(int j = 1; j <= n; j++){
  30. cout << " ---";
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement