From 11e8f4878bb9bf48567ff920c9cf23764525bfc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?byezhao=E7=99=BD=E5=85=86?= <52312161+byezhao@users.noreply.github.com> Date: Sun, 27 Oct 2019 11:58:15 +0800 Subject: [PATCH] =?UTF-8?q?Update=20BASIC-10=20=E5=9F=BA=E7=A1=80=E7=BB=83?= =?UTF-8?q?=E4=B9=A0=20=E5=8D=81=E8=BF=9B=E5=88=B6=E8=BD=AC=E5=8D=81?= =?UTF-8?q?=E5=85=AD=E8=BF=9B=E5=88=B6.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1\345\205\255\350\277\233\345\210\266.cpp" | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git "a/\345\237\272\347\241\200\347\273\203\344\271\240/C++/BASIC-10 \345\237\272\347\241\200\347\273\203\344\271\240 \345\215\201\350\277\233\345\210\266\350\275\254\345\215\201\345\205\255\350\277\233\345\210\266.cpp" "b/\345\237\272\347\241\200\347\273\203\344\271\240/C++/BASIC-10 \345\237\272\347\241\200\347\273\203\344\271\240 \345\215\201\350\277\233\345\210\266\350\275\254\345\215\201\345\205\255\350\277\233\345\210\266.cpp" index 8b156fa..f2be39b 100644 --- "a/\345\237\272\347\241\200\347\273\203\344\271\240/C++/BASIC-10 \345\237\272\347\241\200\347\273\203\344\271\240 \345\215\201\350\277\233\345\210\266\350\275\254\345\215\201\345\205\255\350\277\233\345\210\266.cpp" +++ "b/\345\237\272\347\241\200\347\273\203\344\271\240/C++/BASIC-10 \345\237\272\347\241\200\347\273\203\344\271\240 \345\215\201\350\277\233\345\210\266\350\275\254\345\215\201\345\205\255\350\277\233\345\210\266.cpp" @@ -1,23 +1,12 @@ -#include +#include + using namespace std; -int main() { - int a; - cin >> a; - int i = 0; - char b[100]; - if (a == 0) { - cout << "0"; - } else { - while (a != 0) { - if (a % 16 >= 10) - b[i++] = a % 16 + 'A' -10; - else - b[i++] = a % 16 + '0'; - a = a / 16; - } - } + +int main() +{ + int n; + cin >> n; + printf("%X", n); - for (int k = i - 1; k >= 0; k--) - cout << b[k]; return 0; -} \ No newline at end of file +}