我正在学习初学C++课程.我收到一个作业,告诉我编写一个程序,将二进制和十六进制之间的任意基数中的任意数字转换为二进制和十六进制之间的另一个基数.我被要求使用单独的函数来转换为基数10.这是为了帮助我们习惯使用数组.(我们之前在课堂上已经介绍了参考文献.)我已经把它转过来了,但我很确定这不是我的意思:
#include <iostream>
#include <conio.h>
#include <cstring>
#include <cmath>
using std::cout;
using std::cin;
using std::endl;
int to_dec(char value[], int starting_base);
char* from_dec(int value, int ending_base);
int main() {
char value[30];
int starting_base;
int ending_base;
cout << "This program converts from one base to another, so long as the bases are" << endl
<< "between 2 and 16." << endl
<< endl;
input_numbers:
cout << "Enter the number, then starting base, then ending base:" << endl;
cin >> value >> starting_base …Run Code Online (Sandbox Code Playgroud) 我有一个使用ibm cp437的cpp文件,Visual C++继续用windows-1252读取它.如何使Visual C++为文件使用正确的代码页?