C++ swap()函数

2018/03/04 C 共 259 字,约 1 分钟
#include<iostream>
#include<string>
#include<cstring>
#include<stdio.h>
#include<vector>
using namespace std;
int main() {
    vector<int> a;
    a.push_back(3);
    a.push_back(4);
    swap(a[0],a[1]);
    cout<<a[0]<<" "<<a[1]<<endl;
}

Search

    Table of Contents