Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cmath>
- #include<iostream>
- #include <stdlib.h>
- #include <conio.h>
- #include <iomanip>
- using namespace std;
- int main() {
- int cols, rows;
- bool k;
- cout << " n, m: " << endl;
- cin >> rows >> cols;
- if(!cin){
- cout << "Error" << endl;
- getch();
- return 0;
- }
- int **mass = new int *[rows];
- for (int i = 0; i < rows; i++) {
- mass[i] = new int[cols];
- }
- for (int i = 0; i < rows; i++) {
- for (int j = 0; j < cols; j++) {
- cout << " mass[" << i + 1 << "][" << j + 1 << "]= " << endl;
- cin >> mass[i][j];
- }
- }
- for (int i = 0; i < rows; ++i) {
- for (int j = 0; j < cols; ++j) {
- cout << setw(2) << mass[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl;
- for (int j = 0; j < cols; j++) {
- k = 1;
- for (int i = 0; i < rows; i++)
- if (mass[i][j] != 0) {
- k = 0;
- break;
- }
- if (k == 1) {
- cout << 0;
- }
- else cout << 1 << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement