0

I am a newbie and currently taking as a subject data structures and algorithms. I have posted the function I'm currently working on down below. It works the problem is I would like to ensure I'm meeting the professors intent. I'm supposed to write a recursive and nonrecursive function to print out nonnegative integers in binary. The functions should not use bitwise operations. The function below is my recursive function. Please advise me if I am going in the wrong direction.

```
#include <iostream>
using namespace std;
void binequ( int, int );
int main()
{
int posint;
cout << "The purpose of this program is to convert\na nonnegative integer into binary form.\n";
cout << "\nEnter a positive Integer: ";
cin >> posint;
cout << "\nThe Binary equivalent is: ";
binequ( posint, 2 );
cout << endl;
system("PAUSE");
return 0;
}
void binequ(int num, int base)
{
if (num > 0)
{
binequ(num/base, base);
cout<< num % base;
}
}
```