小编Spi*_*ity的帖子

简化我的程序,将数字从一个基数转换为另一个基数

我正在学习初学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)

c++

10
推荐指数
1
解决办法
1万
查看次数

如何更改MS Visual Studio 2008用于打开文件的代码页?

我有一个使用ibm cp437的cpp文件,Visual C++继续用windows-1252读取它.如何使Visual C++为文件使用正确的代码页?

codepages visual-studio-2008 visual-c++

3
推荐指数
1
解决办法
9251
查看次数

标签 统计

c++ ×1

codepages ×1

visual-c++ ×1

visual-studio-2008 ×1