Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ return multiple values

#include <tuple>

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

#include <iostream>

int main() {
    using namespace std;

    int quotient, remainder;

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

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

PREVIOUS NEXT
Code Example
Cpp :: convert hex to decimal arduino 
Cpp :: c++ exeption handling 
Cpp :: c++ get microseconds since epoch 
Cpp :: 3. The method indexOf, part of the List interface, returns the index of the first occurrence of an object in a List. What does the following code fragment do? 
Cpp :: point in polygon 
Cpp :: variable modulus 5 meaning in c++ 
Cpp :: stricmp CPP 
Cpp :: C++ Detect when user presses arrow key 
Cpp :: how to code a game in c++ 
Cpp :: sfml thread multi argument function 
Cpp :: what does map.count() return in c++ 
Cpp :: int and char in c++ compiler 
Cpp :: Opengl GLFW basic window 
Cpp :: txt to pdf CPP 
Cpp :: accepting string with space on same line C++ 
Cpp :: c++ program to convert celsius to fahrenheit 
Cpp :: how to print out a two dimensional array in c++ 
Cpp :: passing array to the function c++ 
Cpp :: cpprestsdk header 
Cpp :: c++ multiple if conditions 
Cpp :: c++ poitner 
Cpp :: ue4 c++ string from fvector 
Cpp :: Maximum Cake Tastiness codeforces solution 
Cpp :: easy way to learn file handling in c++ array 
Cpp :: days in a year c++ 
Cpp :: how to know how many numbers i deleted with erase command on multiset c++ 
Cpp :: Stream Overloading 
Cpp :: sort n characters in descending order c++ 
Cpp :: cplusplus 
Cpp :: map update field elixir 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =