Advertisement
Courbe_Impliquee

зеркало

Feb 15th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. // ConsoleApplication25.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <iomanip>
  7. #include "stdio.h"
  8. #include <clocale>
  9. using namespace std;
  10. int _tmain(int argc, _TCHAR* argv[])
  11. {
  12. setlocale(LC_ALL, "rus");
  13. int n, m;
  14. float temp;
  15. cout << "Введите размер матрицы:";
  16. cin >> n >> m;
  17. cout << endl;
  18. float **a = new float*[n];
  19. for (int i = 0; i < n; i++)
  20. a[i] = new float[m];
  21. cout << "Введите элементы матрицы:" << endl;
  22. for (int i = 0; i < n; i++){
  23. for (int j = 0; j < m; j++)
  24. cin >> a[i][j];
  25. }
  26. cout << endl;
  27. if (n % 2 == 0){
  28. for (int i = 0; i < (n / 2); i++){
  29. for (int j = 0; j < m; j++){
  30. temp = a[i][j];
  31. a[i][j] = a[n - 1 - i][j];
  32. a[n - 1 - i][j] = temp;
  33. }
  34. }
  35. }
  36. else{
  37. for (int i = 0; i <= (n / 2); i++){
  38. for (int j = 0; j < m; j++){
  39. temp = a[i][j];
  40. a[i][j] = a[n - 1 - i][j];
  41. a[n - 1 - i][j] = temp;
  42. }
  43. }
  44. }
  45. for (int i = 0; i < n; i++){
  46. for (int j = 0; j < m; j++){
  47. cout << a[i][j]<<" ";
  48. }
  49. cout << endl;
  50. }
  51. system("pause");
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement