cpp05.cpp

来自「C++参考书」· C++ 代码 · 共 33 行

CPP
33
字号

// Coded by plusir -- Jan.11.2003.
// Standard C++ Bible -- (P596-22-5)

#include <iostream>
#include <algorithm>
#include <set>
using namespace std ;

int main()
{
	set<char> charSet1, charSet2 ;

	for ( int i = 0; i < 5; ++i ) {
		charSet1.insert( 65 + i ) ;
		charSet2.insert( 70 + i ) ;
	}

	ostream_iterator<char> output( cout, " " ) ;
	cout << "Contents of first set: " ;
	copy( charSet1.begin(), charSet1.end(), output ) ;
	cout << endl ;
	cout << "Contents of secon set: " ;
	copy( charSet2.begin(), charSet2.end(), output ) ;
	cout << endl << endl ;

	cout << "set1 " ;
	cout << ( charSet1 == charSet2 ? "==" : ( charSet1 < charSet2 ? "<" : ">" ) ) ;
	cout << " set2" << endl ;

	return 0 ;
}

⌨️ 快捷键说明

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