📄 pr21018.cpp
字号:
////////////////////////////////////////
// File Name: pr21018.cpp
////////////////////////////////////////
#include <iostream>
#include <list>
int main()
{
// Create two list objects.
std::list<char> charList1;
for (int x=0; x<10; ++x)
charList1.push_front(65 + x);
std::list<char> charList2;
for (int x=0; x<10; ++x)
charList2.push_front(66 + x);
// Display the lists.
std::cout << "list 1: ";
std::list<char>::iterator iter;
for (iter = charList1.begin();
iter != charList1.end(); iter++)
{
cout << *iter;
}
std::cout << std::endl;
std::cout << "list 2: ";
for (iter = charList2.begin();
iter != charList2.end(); iter++)
{
cout << *iter;
}
std::cout << std::endl;
// Compare the lists.
if (charList1 == charList2)
std::cout << "list1 == list2";
else if (charList1 < charList2)
std::cout << "list1 < list2";
else if (charList1 > charList2)
std::cout << "list1 > list2";
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -