Trở về đầu
Mời các bạn download tại: Click here
#include<iostream>
#include<algorithm>
#include <iomanip>
using namespace std;
int main() {
cout << min(5, 3) << endl;
cout << max(5, 3) << endl;
const int MAXN = 3;
int a[MAXN] = {1, 2, 3};
int x = 2, y = 4;
swap(x, y);
cout << "x = " << x << ", y = " << y << endl;
int i;
int dem = 0;
// do {
// dem++;
// cout << setw(3) << dem << ": ";
// for (i=0; i<MAXN; i++)
// cout << a[i] << " ";
// cout << endl;
// }
// while (next_permutation(a, a+MAXN) == true);
cout << endl << endl;
int b[MAXN] = {3, 2, 1};
do {
dem++;
cout << setw(3) << dem << ": ";
for (i=0; i<MAXN; i++)
cout << b[i] << " ";
cout << endl;
}
while (prev_permutation(b, b+MAXN) == true);
}