Advertisement
Courbe_Impliquee

Удаление столбца

Feb 15th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. // ConsoleApplication25.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include "stdio.h"
  7. #include <clocale>
  8. using namespace std;
  9. int _tmain(int argc, _TCHAR* argv[])
  10. {
  11. setlocale(LC_ALL, "rus");
  12. int n, m,c;
  13. float temp;
  14. bool f;
  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. for (int j = 0; j < m; j++){
  28. f = 0;
  29. for (int i = 0; i < n; i++){
  30. if (a[i][j] < 0){
  31. f = 1;
  32. }
  33. }
  34. if (f==0 && j!=m-1){
  35. for (int i = 0; i < n; i++){
  36. a[i][j] = temp;
  37. a[i][j] = a[i][m - 1];
  38. a[i][m - 1] = temp;
  39. }
  40. }
  41. }
  42. for (int i = 0; i < n; i++){
  43. for (int j = 0; j < m; j++){
  44. cout << a[i][j];
  45. }
  46. cout << endl;
  47. }
  48. system("pause");
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement