1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
for (int i = convertTheLength - 1; i >= 0; i--) {
switch(convert.at(i)) {
case '0':
newCoor +=0 * pow(base, exp);
break;
case '1':
newCoor +=1 *pow(base, exp);
break;
case '2':
newCoor+=2 *pow (base, exp);
break;
case '3':
newCoor+=3 * pow (base, exp);
break;
case '4':
newCoor+=4 * pow (base, exp);
break;
case '5':
newCoor+=5 * pow (base, exp);
break;
case '6':
newCoor+=6 * pow (base, exp);
break;
case '7':
newCoor+=7 * pow (base, exp);
break;
case '8':
newCoor+=8 * pow (base, exp);
break;
case '9':
newCoor+=9 * pow (base, exp);
break;
case 'A':
newCoor+=10 * pow (base, exp);
break;
case 'B':
newCoor+=11 * pow (base, exp);
break;
case 'C':
newCoor+=12 * pow (base, exp);
break;
case 'D':
newCoor+= 13 * pow (base, exp);
break;
case 'E':
newCoor+= 14 * pow (base, exp);
break;
case 'F':
newCoor+= 15 * pow (base, exp);
break;
}
exp++;
}
return newCoor;
}
|