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

📄 main.cpp

📁 对于c++primer中前面几章的练习以及书上的例子
💻 CPP
字号:
#include <cstdlib>
#include <iostream>
#include<vector>
using namespace std;
const int lineLength=12;
void putValue(vector<int> vec)
{
     cout<<"("<<vec.size()<<")<";
     for(int i=0;i<vec.size();++i){
             if(i%lineLength==0&&i)
             cout<<"\n\t";
             cout<<vec[i];
             if(i%lineLength!=lineLength-1&&i!=vec.size()-1)
             cout<<",";
             }
             cout<<">\n";
 }
int main(int argc, char *argv[])
{
    int i,j[2];
    vector<int> vecl(1);
    vecl[0]=i;
    putValue(vecl);
    vector<int> vec2;
    for(int ix=0;ix<sizeof(j)/sizeof(j[0]);++ix)
    vec2.push_back(j[ix]);
    putValue(vec2);
    system("PAUSE");
    return EXIT_SUCCESS;
}

⌨️ 快捷键说明

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