IT currently is set up for base 3, but should be able to make a couple of minor changes and convert to any base, thanks and hope it helps someone out.
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
void convert_base(int v, int b);
ifstream inputdata;
ofstream outputdata;
int main(int argc, char *argv[]){
//int a, b, c, d, e, f, i;
int v;
int base = 3;
inputdata.open("Base_Conversion_File.dat");
if(!inputdata){
cout << "There was a problem opening the data file." << endl;
return 1;
}
inputdata >> v;
outputdata.open("Converted_data.out");
if(!outputdata){
cout << "There was a problem created the output file." << endl;
}
while (inputdata >> v) {
outputdata << v << " converted to base " << base << " is ";
convert_base( v, base );
outputdata << "\n";
}
inputdata.close();
outputdata.close();
return 0;
}
void convert_base(int v, int b){
int k, i;
int max;
k = floor(log10(v)/log10(b)) + 1;
max = k;
for(i = 0; i < max; i++){
outputdata << (int)(v/ pow(b, k-1));
v = v % (int)pow(b, k-1);
k = k - 1;
}
outputdata << endl;
}