need help w/ number converter prog.

This program is suppoded to get an input of any number in any number system with a base from 2(binary) to 62, which includes all digits plus all capital and then all lower case letters.

Code:

`#include <iostream>`

#include <string>

using namespace std;

string relet (int input)

{

string output;

if (input == 0)

output="0";

if (input == 1)

output="1";

// ect, ect, ect.

if (input == 61)

output="z";

return output;

}

int unlet (string input)

{

int output;

if (input == "0")

output=0;

if (input == "1")

output=1;

//ect, ect, ect.

if (input == "z")

output=61;

return output;

}

int main ()

{

string number;

int base;

int newbase;

// (removed for space) This part gets user input for number, base, and newbase.

const int length=number.length();

int input[length];

int * output;

output[0]=0;

// This loop puts the number into array "input", while reversing the numbers

// and replaces letters with their decimal number equivilents

int x=0;

int y=length-1;

string buffer;

start1:

buffer=number[y];

input[x]=unlet (buffer);

x++;

y--;

if (x != length)

goto start1;

y=0;

x=0;

// -THE IMPORTANT PART-

// subtracts 1 from the input

substart:

if (input[x] == 0)

{

input[x]=base-1;

x++;

if (x == length) // end if the input is 0

goto finish;

goto substart;

}

input[x]--;

x=0;

// adds 1 to the output

addstart:

// this adds another digit to the output when nessecary

if (x > y)

{

output = new int;

output[x]=0;

y++;

}

if (output[x] == newbase-1)

{

output[x]=0;

x++;

goto addstart;

}

output[x]++;

x=0;

goto substart;

finish:

//(removed) outputs the "output" array starting from the top down and uses the

//"relet" function.

It works sometimes, but if the output is more than 2 digits it will sometimes add 1 to the second digit, and it crashes if the output is more than 4 digits long.

I have gone through the code countless times and cannot figure out what is making it not work. I can post the full code it anyone wants.