Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication25.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <iostream>
- #include "stdio.h"
- #include <clocale>
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- setlocale(LC_ALL, "rus");
- int n, m,c;
- float temp;
- bool f;
- cout << "Введите размер матрицы:";
- cin >> n >> m;
- cout << endl;
- float **a = new float* [n];
- for (int i=0; i < n; i++)
- a[i] = new float[m];
- cout << "Введите элементы матрицы:"<<endl;
- for (int i=0; i < n; i++){
- for (int j=0; j < m; j++)
- cin >> a[i][j];
- }
- cout << endl;
- for (int j = 0; j < m; j++){
- f = 0;
- for (int i = 0; i < n; i++){
- if (a[i][j] < 0){
- f = 1;
- }
- }
- if (f==0 && j!=m-1){
- for (int i = 0; i < n; i++){
- a[i][j] = temp;
- a[i][j] = a[i][m - 1];
- a[i][m - 1] = temp;
- }
- }
- }
- for (int i = 0; i < n; i++){
- for (int j = 0; j < m; j++){
- cout << a[i][j];
- }
- cout << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement