Trở về đầu

foto1 foto2 foto3 foto4 foto5
Giảng viên
Nguyễn Tô Sơn - Thủ khoa Đại học Sư phạm Hà Nội
ĐT: 091.333.2869

HỌC TIN CÙNG THỦ KHOA

Thành công không phải đích đến, mà là cả một hành trình

Tìm kiếm

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);


}

Giảng viên Nguyễn Tô Sơn, Thủ khoa Đại học Sư phạm Hà Nội. Điện thoại: 091.333.2869