几种常见语言的基本语法对比:字符串

2021-07-08 02:06

阅读:616

标签:strong   如何   col   基本语法   vector   ace   memory   其他   引用   

c++: 一段时间不写c++。简直又是忘光了。而其他语言几年不写。几个小时就回想起来了。还是c++太难了。各种用法。学的时候就没学明白。

写代码的时候,一直回想 ,如这个参数,是否用常引用。  vecotr是如何实现的?string是如何实现的。string[] 堆栈是如何放的。

只要涉及到堆。基本不用写代码了。一头郁闷包,算了c++。永别了。例子都不 敢写完。随便写下吧。

#include 
#include using namespace std;

string JoinString(vectorstring> books)
{
    string *ret=new string("");
    int count=books.size();
    coutendl;
    for(int i=0;ii)
    {
        ret->append(books[i]);
    }
    return *ret;
}



int main()
{
    string books[]={"c++ primer","c#"};
    cout0]endl;
    cout1]endl;
    cout0]endl;
    cout1]endl;

    vectorstring> *myarray=new vectorstring>();//memory ..
    myarray->push_back(books[0]);
    myarray->push_back(books[1]);

    coutendl;


    delete myarray;
    return 0;
}

 

几种常见语言的基本语法对比:字符串

标签:strong   如何   col   基本语法   vector   ace   memory   其他   引用   

原文地址:https://www.cnblogs.com/lsfv/p/9585040.html


评论


亲,登录后才可以留言!