比较常用的C++程序代码片段

#include 

using namespace std;

static void pause( void )
{
	system( "pause" );
	return;
}

int main()
{
	unsigned int mywidth = 4;
	unsigned int mybits = 12;

	while(!(mywidth&(1u<<(mybits-1))))
	{
		mybits--;//find highest bit of 1 in mywidth
		cout << hex << mybits << endl;
		if(!mybits)break;
	}
	cout << hex << mybits << endl;
	pause();

	return 0;
}

你可能感兴趣的:(编程语言)