Well, how about you think of it in each case. There should be 4 cases in this case...
case #1 - enter base 2 number, you can easily convert a binary (with 0 and 1) by iterating through the number and add the total sum of 2^(n-1) where n is the number of digit entered.
case #2 - enter base 8 number, you can do the same thing as in base 2
case #3 - enter base 10 number, you just simply display it.
case #4 - enter base 16 number, you also do the same thing as in base 2 & 8.
What you really need to keep in the loop are...
1)The input number must be 0, 1, 2, .., 9, A~F. Other input will be reject and need to be reenter.
2)After you accept a number, you must verify that the base type enter matches the number type. For example, a base 2 must consist of only 0 and 1. If it doesn't match, you could either reject and ask for a new input number or reject and ask for a new base number.
You need to solve this 2 loop problem first. Once you get correct input values, you compute and display result. After that you may add another loop for user to either enter again or quit. That's all...
PS: Use a loop to go through a number string when compute. Why do you need hard coded when you can actually read each character from the input number string using a loop?