📜  c++ 返回多个值 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:50.481000             🧑  作者: Mango

代码示例1
#include 

std::tuple divide(int dividend, int divisor) {
    return  std::make_tuple(dividend / divisor, dividend % divisor);
}

#include 

int main() {
    using namespace std;

    int quotient, remainder;

    tie(quotient, remainder) = divide(14, 3);

    cout << quotient << ',' << remainder << endl;
}