zoukankan      html  css  js  c++  java
  • 初识STL vector

    写这个主要是当作笔记来写的,配上自己的理解加上一些测试示例;

    上代码:

    #include<iostream>
    #include<cstring>
    #include<vector>
    #include<cstdio>
    #include<algorithm>
    #define g 10000
    using namespace std;
    struct nood
      {
        int a;
        int b;
        char c;
      };
    int main()
      {
        /**/
        vector<int> a,b;

        for(int i=0; i<10; i++)
        a.push_back(i);
        for(int i=0; i<10; i++)
          cout<<a[i]<<" ";
          for(int i=0; i<=10; i++)
          b.push_back(i);
        cout<<endl<<endl;
        for(int i=0; i<=10; i++)
          cout<<b[i]<<" ";
        cout<<endl<<"a=b? :"<<(a==b)<<" "<<endl<<endl;
        /**/
        nood xx;
        vector<struct nood> x,y;
        xx.a=100;
        xx.b=200;
        xx.c='B';
        x.push_back(xx);
        cout<<"xx.a=x[0].a? :"<<(xx.a==x[0].a)<<endl<<endl;
        /**/
        vector<string> d;
        vector<char> c;
        string dd;
        char cc='a';
        dd="asdasda~~";
        d.push_back(dd);
        d.push_back(dd);
        c.push_back(cc);
        cout<<d[0]<<" "<<d[1]<<endl;
        cout<<"d[0]=d[1]? :"<<(d[0]==d[1])<<endl
            <<"d[0]!=d[1] :"<<(d[0]!=d[1])<<endl;
        cout<<endl<<c[0]<<endl;
        /**/
        vector<vector<int> > aaa;
        aaa.push_back(a);
        aaa.push_back(b);
        for(int i=0;i<20;i++)
        cout<<aaa[i][i]<<endl;
        return 0;
      }

    还有一些常用的删减查找过几天写 嘻嘻~~.

    现在混个时间吗!!

    好强发现了宝贝


    #include <iomanip>

    https://baike.baidu.com/item/iomanip/3319954?fr=aladdin.html

  • 相关阅读:
    WPF项目学习.一
    AtCoder Beginner Contest 210 A~D 题解
    P7715 「EZEC-10」Shape 题解
    P6216 回文匹配 题解
    字符串学习笔记
    #2742. 「JOI Open 2016」销售基因链
    树状数组学习笔记
    2021 省选游记
    AtCoder Beginner Contest 196 E
    AtCoder Regular Contest 113 A~D题解
  • 原文地址:https://www.cnblogs.com/maxv/p/10585155.html
Copyright © 2011-2022 走看看