The boring history class has compiled a binary conversion software, the software is relatively single, only decimal to binary, octal, hexadecimal conversion.
With the convenience of C4droid, the APK is generated directly, Andro-all.
/** Copyright (c) 2014, Yantai University School of Computer * All right reserved.* Shao * file: demo.cpp* finish: December 16, 2014 * version number: v1.0*/#include <iostream >using namespace std;//decimal number converted to binary number void swap_1 (int n) {if (n < 2) cout << N; if (n >= 2) {swap_1 (N/2); cout << n% 2; }}//decimal number converted to octal number void swap_2 (int n) {if (N < 8) cout << N; if (n >= 8) {swap_2 (N/8); cout << n% 8; }}//decimal number converted to hexadecimal number void swap_3 (int n) {switch (n) {case 10:cout << "A"; Break Case 11:cout << "B"; Break Case 12:cout << "C"; Break Case 13:cout << "D"; Break Case 14:cout << "E"; Break Case 15:cout << "F"; Break Default:cout << N; }}void swap_4 (int n) {if (n <) swap_3 (n); if (n >=) {swap_4 (N/16); Swap_3 (n% 16); }}int MaiN () {int num,choice; int a[100], n = 0, I; cout << "1_ decimal → binary" << endl; cout << "2_ decimal → octal" << endl; cout << "3_ decimal → hex" << endl; cout << "Please enter the function to select:"; CIN >> Choice; cout << "Please enter a value to convert:"; CIN >> Num; if (choice = = 1) {cout << num << "Convert to binary:"; Swap_1 (num); cout << Endl; } else if (choice = = 2) {cout << num << "Convert to octal:"; Swap_2 (num); cout << Endl; } else if (choice = = 3) {cout << num << "translates to 16 binary as:"; Swap_4 (num); cout << Endl; }}
Computer-side display:
Android display: (Android4.4.4)
Next project, make a Visual basic-based conversion.
Wait for the wind to come.
@ Mayuko
Binary conversion-c++