c04p223.txt

来自「Data Abstraction & Problem Solving with 」· 文本 代码 · 共 23 行

TXT
23
字号
list<int> myList;list<int>::iterator curr;// right now, the list is empty;// start the iterator at the beginning of myListcurr = myList.begin();// test for empty listif (curr == myList.end())   cout << "The list is empty" << endl;// insert five items into the list myListfor (int j = 0; j < 5; j++)   // places item j at the front of the list   curr = myList.insert(curr, j);// now output each item in the list starting with the// first item in the list; keep moving the iterator// to the next item in the list until the end of// the list is reachedfor (curr = myList.begin(); curr != myList.end(); curr++)   cout << *curr << " ";cout << endl;

⌨️ 快捷键说明

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