Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include "math.h"
- using namespace std;
- int main()
- {
- int s, m = 1, sum=0;
- cout « "Enter the matrix size : " « endl;
- cin » s;
- int **array = new int*[s];
- for (int i = 0; i < s; i++)
- {
- array[i] = new int[s];
- }
- for (int i = 0; i < s; i++)
- {
- for (int j = 0; j < s; j++) {
- cout « "Enter the [" « i « "] [" « j « "] element: ";
- cin » array[i][j];
- }
- }
- cout « "Result : " « endl;
- bool ans = false;
- for (int i = 0; i < s; i++) {
- for (int j = 0; j < s; j++) {
- if ((array[i][j] < 0)) {
- ans = true;
- cout « "[" « array[i][j] « "]";
- }
- }
- }
- if (ans == false)
- cout « "No elements." « endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement