Converting Integers to Hex...

Ok, I'm having a little trouble with my code. I have it all setup to convert from decimal to Binary, Octal, and hex. However, with hex I get 1515 and not FF. Even though that would technically be right, I need to make it show FF. Here's my code thus far:

Code:

`//Exercise 10`

//Matt Biegner

#include <iostream>

using namespace std;

void convert(int number, int base);

int main()

{

int number;

int option;

cout << "Enter an integer in decimal: ", cin >> number, cout << endl;

cout << "Convert from decimal into:\n";

cout << "0 - Binary\n";

cout << "1 - Octal\n";

cout << "2 - Hexadecimal\n";

cin >> option, cout << endl;

switch (option)

{

case 0:

convert(number, 2);

break;

case 1:

convert(number, 8);

break;

case 2:

convert(number, 16);

break;

}

return 0;

}

void convert(int number, int base)

{

int result = 0;

int store[35];

for(int i = 0; i < number;){

++result;

store[result] = number % base;

number /= base;}

while(result > 0){

cout << store[result];

--result;

}

cout << endl << endl;

}

----

Matt Biegner