UVa 10473 Simple Base Conversion:两句话实现进制转换2014-07-07 synapse7 10473 - Simple Base ConversionTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=141410->16:atoi+%X16->10:strtol+%d完整代码:
01./*0.019s*/02.03.#include<cstdio>04.#include<cstdlib>05.06.char s[15];07.08.int main()09.{10.while (gets(s), s[0] != "-")11.if (s[1] == "x") printf("%d
", strtol(s, NULL, 16));12.else printf("0x%X
", atoi(s));///注意十六进制中的字母要大写13.return 0;14.}