Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main(){
- int n, m;
- cin>>n;
- cin>>m;
- int arr[n][m];
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++){
- arr[i][j] = rand()%10;
- }
- }
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++){
- cout << setw(4) << arr[i][j];
- }
- cout << endl;
- }
- cout << "\n";
- for (int i = 0, j = 0; i < n, j < m; i++, j++){
- int a = arr[i][m -1 - j];
- arr[i][m-1-j] = arr[i][j];
- int b = arr[i][m-1-j];
- arr[i][j] = a;
- if (a == b){
- cout << a<< endl;
- };}
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++){
- cout << setw(4) << arr[i][j];
- }
- cout << endl;}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement