Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using namespace std;
- void main() {
- int sohang, socot;
- cout << "Nhap so hang, so cot :";
- cin >> sohang >> socot;
- int **a = new int*[sohang];
- for (int i = 0; i < sohang; i++) {
- a[i] = new int[socot];
- for (int j = 0; j < socot; j++) {
- cout << "nhap a[" << i +1<< "][" << j+1 << "]";
- cin >> a[i][j];
- }
- }
- for (int i = 0; i < sohang; i++) {
- for (int j = 0; j < socot; j++) {
- cout << "\n\t" << a[i][j];
- }
- cout << endl;
- }
- for (int i = 0; i < sohang; i++) {
- for (int j = 0; j < socot; j++)
- for(int k=0;k<socot;k++){
- if ((a[i][j] < a[i][k])){
- int tam = a[i][k];
- a[i][k] = a[i][j];
- a[i][j] = tam;
- }
- }
- }
- cout << endl << endl;
- for (int i = 0; i < sohang; i++) {
- for (int j = 0; j < socot; j++) {
- cout << "\n\t"<< a[i][j];
- }
- cout << endl;
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement