码迷,mamicode.com
首页 > 编程语言 > 详细

C++ cout的转换格式输出(八进制和十六进制)

时间:2014-08-22 10:54:36      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:c++

// hex,oct 输出
#include<iostream>

using namespace std;

int main()
{
	
	int chest = 42, waist = 42, inseam = 42;
	
	cout << "chest = " <<chest << " (decimal for 42)" << endl;
	cout << hex;	// manipulator for changing number base
	cout << "waist = " << waist << " (hexadecimal for 42)" << endl;
	cout << oct;	//manipulator for changing number base
	cout << "inseam = " << inseam << " (octal for 42)" << endl;
	return 0;
} 

C++ cout的转换格式输出(八进制和十六进制),布布扣,bubuko.com

C++ cout的转换格式输出(八进制和十六进制)

标签:c++

原文地址:http://blog.csdn.net/xln0539xln/article/details/38751383

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!