Simple program | Recursion

Hi, so I get the error:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ostream:1101:1: note:
candidate template ignored: could not match 'bitset<_Size>' against 'void'
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)

I would like to know where is the problem as my program is below and it doesn't run. Thank you!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

using namespace std;

void myFunction(int counter)
{
  if (counter == 0)
    return;
  else
    {
    cout << counter << endl;
    myFunction(--counter);
    return;
    }
}

int main()
{
  cout << myFunction(10) << endl;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

using namespace std;

void myFunction(int counter)
{
  if (counter == 0)
    return;
  else
    {
    cout << counter << endl;
    myFunction(--counter);
    return;
    }
}

int main()
{
  myFunction(10);
}
@ Grey Wolf >> Thanks.
Topic archived. No new replies allowed.