⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example4_5.cpp

📁 data+structures+using+c的源码
💻 CPP
字号:
#include <iostream>

#include <vector>

using namespace std;

int main()
{
	vector<int>  intList;					//Line 1
	int i;									//Line 2
		
	intList.push_back(13);					//Line 3
	intList.push_back(75);					//Line 4
	intList.push_back(28);					//Line 5
	intList.push_back(35);					//Line 6

	cout<<"Line 7: List Elements: ";		//Line 7
	for(i = 0; i < 4; i++)					//Line 8
	    cout<<intList[i]<<" ";				//Line 9
	cout<<endl;								//Line 10			
	for(i = 0; i < 4; i++)					//Line 11
	    intList[i] *= 2;					//Line 12

	cout<<"Line 13: List Elements: ";		//Line 13
	for(i = 0; i < 4; i++)					//Line 14
	    cout<<intList[i]<<" ";				//Line 15
	cout<<endl;								//Line 16

	vector<int>::iterator  listIt;			//Line 17

	cout<<"Line 18: List Elements: ";		//Line 18
 	for(listIt = intList.begin(); listIt != intList.end(); 
								++listIt)	//Line 19
	    cout<<*listIt<<" ";					//Line 20
	cout<<endl;								//Line 21	
	listIt = intList.begin();				//Line 22
	++listIt;								//Line 23
	++listIt;								//Line 24
	intList.insert(listIt,88);				//Insert 88 at the  
											//position specified 
											//by listIt		//Line 25

	cout<<"Line 26: List Elements: ";		//Line 26
	for(listIt = intList.begin(); listIt != intList.end(); 
							++listIt)		//Line 27
	    cout<<*listIt<<" ";					//Line 28
	cout<<endl;								//Line 29

	return 0;
}

⌨️ 快捷键说明

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