passing a reference variable

I have a function and code here

void divideWithRemainder(int a, int b, int& q, int&r){
q = a/b; //quotient of integers
r = a%b; //remainder
}

int main(){
cout << divideWithRemainder(10, 3) << endl;

return 0;
}

this will not produce anything because it says not enough arguments. however i attempted to add an "int q" and "int r" into my main functions and pass those to no avail. Can anyone provide some assistance on this?
Well you can't cout it to begin with, because it's a void function.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
using namespace std;

void divideWithRemainder(int a, int b, int& q, int&r){
  q = a/b; //quotient of integers
  r = a%b; //remainder
}

int main(){
  int q, r;
  divideWithRemainder(10, 3, q, r);
  cout << q << "," << r << endl;
  return 0;
}


Use code tags in future, you're past 10 posts, you really ought to know this by now.
https://www.cplusplus.com/articles/jEywvCM9/
By the way, cstdlib has the div() function that computes both the remainder and quotient. It may be faster than doing them separately because it can use a CPU instruction that does them both.
http://www.cplusplus.com/reference/cstdlib/div/
thank you so much for the feedback
Topic archived. No new replies allowed.