I posted it before. I got some answers but wont be able to run the program. The idea is to put some Decimal numbers and get it as binary in a file. The program is-
Code:
#include <iostream>
#include<fstream>
using namespace std;
int Binary( int, int );
int main()
{
ofstream MosFile("Milloin_Binary.rtf");
int decimal;
int a,o;
int b[1000000];
cout << "Enter a Decimal Integer to convert it to binary: ";
cin >> decimal;
for(a=1,o=0;a<= decimal;a++,o++)
{
b[o]=Binary( a,2 );
MosFile<<b[o]<<"\n";
}
MosFile.close();
}
int Binary(int num, int base)
{
if (num > 0)
{
Binary(num/base, base);
return (num % base);
}
}
Any advice to modify it for accomplishing the goal ?