📄 main.cpp
字号:
#include <iostream>
#include <stdlib.h>
#include <map>
#include <vector>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
// Iterating through a map
map<string, int> NumberWords;
NumberWords["ten"] = 10;
NumberWords["twenty"] = 20;
NumberWords["thirty"] = 30;
map<string, int>::iterator loopy = NumberWords.begin();
while (loopy != NumberWords.end()) {
cout << loopy->first << " ";
cout << loopy->second << endl;
loopy++;
}
// Iterating through a vector
vector<string> Words;
Words.push_back("hello");
Words.push_back("there");
Words.push_back("ladies");
Words.push_back("and");
Words.push_back("aliens");
vector<string>::iterator vectorloop = Words.begin();
while (vectorloop != Words.end()) {
cout << *vectorloop << endl;
vectorloop++;
}
system("PAUSE");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -