accepting multiple values from a function in cpp

Solutions on MaxInterview for accepting multiple values from a function in cpp by the best coders in the world

showing results for - "accepting multiple values from a function in cpp"
Safiya
10 Jun 2017
1#include<iostream>
2using namespace std;
3void div(int a, int b, int "ient, int &remainder) {
4   quotient = a / b;
5   remainder = a % b;
6}
7main() {
8   int a = 76, b = 10;
9   int q, r;
10   div(a, b, q, r);
11   cout << "Quotient is: "<< q <<"\nRemainder is: "<< r <<"\n";
12}
Andy
15 Sep 2020
1#include<iostream>
2using namespace std;
3void div(int a, int b, int &quotient, int &remainder) {
4   quotient = a / b;
5   remainder = a % b;
6}
7main() {
8   int a = 76, b = 10;
9   int q, r;
10   div(a, b, q, r);
11   cout << "Quotient is: "<< q <<"\nRemainder is: "<< r <<"\n";
12}