Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[10][10];
- cout << "n = ? ( n <= 10 )" << endl; int n; cin >> n;
- cout << "m = ? ( n <= 10 )" << endl; int m; cin >> m;
- //Citire
- for (int i =1; i<=n; i++)
- {
- cout << endl;
- for (int j = 1; j<=m; j++)
- {
- cout << "a[" << i << "][" << j << "] = ";
- cin >> a[i][j];
- }
- }
- //Afisare
- for (int i =1; i<=n; i++)
- {
- cout << endl;
- for (int j = 1; j<=m; j++)
- {
- cout << a[i][j] << " ";
- }
- }
- int l1,l2,c1,c2;
- cout << "l1 = "; cin >> l1;
- cout << "l2 = "; cin >> l2;
- for (int j=1; j<=m; j++)
- {
- swap( a[l1][j], a[l2][j]);
- }
- cout << "c1 = "; cin >> c1;
- cout << "c2 = "; cin >> c2;
- for (int j=1; j<=m; j++)
- {
- swap( a[j][c1], a[j][c2]);
- }
- //Afisare
- for (int i =1; i<=n; i++)
- {
- cout << endl;
- for (int j = 1; j<=m; j++)
- {
- cout << a[i][j] << " ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement