digit.cpp

来自「PHS通信测试程序」· C++ 代码 · 共 33 行

CPP
33
字号
// digit.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <cstdio>
#include "digit_conv.h"
using namespace std;
using namespace digit;

int main(int argc, char* argv[])
{
	printf("Hello World!\n");

	unsigned value; 
	string bstr, ostr, dstr, hstr, str33;
	while(true){
		cout<<"Pls input:";
		cin>>value;
		bstr = DToB(value);
		ostr= DToO(value);
		dstr = DToA(value, 10);
		hstr = DToH(value);
		str33= DToA(value, 33);
		printf("BIN = %s; OCT = %s;  DEC = %s; HEX = %s, 33= %s\n", bstr.c_str(), ostr.c_str(),
			dstr.c_str(), hstr.c_str(), str33.c_str());
		printf("From Bin = %d, from Oct = %d, from Dec = %d, from Hex = %d, from 33 = %d\n", BToD(bstr),
			OToD(ostr), AToD(dstr, 10), HToD(hstr), AToD(str33, 33));
	}

	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?