小编Dre*_*eer的帖子

如何在C++中查找字符串中出现的字符串?

如何在C++中查找字符串中出现的字符串?

这是场景.

string base_string = "BF;1;2;3;FF;10;20;30;BF;11;;22;33;FF;100;200;300;BF;110;;220;330;FF;1000;2000;3000";
string to_find_occurances_of = "BF";
Run Code Online (Sandbox Code Playgroud)

c++

15
推荐指数
1
解决办法
2万
查看次数

如何在C++中使用字符串作为变量名?

可能重复:
将字符串转换为变量名称或变量类型

如何在c ++中将字符串值用作变量名

string listName = "hari";
string vectorName = "BF_vector_"+listName;
vector<string> vectorName;

vectorName.push_back("Some Value");
Run Code Online (Sandbox Code Playgroud)

如何使用vectorName的字符串值("BF_vector_hari")作为向量的变量名.提前致谢.

c++

5
推荐指数
2
解决办法
1万
查看次数

访问结构的char成员变量地址

我有一个结构,我试图打印其成员变量的地址.当试图通过&(fc)打印char成员变量的地址时,我没有得到他们的地址.

这是代码:

struct foo
{
        char c;
        short s;
        void *p;
        int i;
};

int main()
{
        cout << "Size of foo: " << sizeof(foo) << endl;

        foo f;
        cout << "Address of c: " << reinterpret_cast<void*>(&f.c) << endl;
        cout << "Address of c: " << &(f.c) << endl;
        cout << "Address of s: " << reinterpret_cast<void*>(&f.s) << endl;
        cout << "Address of s: " << &(f.s) << endl;
        cout << "Address of p: " << reinterpret_cast<void*>(&f.p) << endl;
        cout …
Run Code Online (Sandbox Code Playgroud)

c++ memory-management

1
推荐指数
1
解决办法
990
查看次数

为什么数组的大小在javascript中打印为零?

以下代码有什么问题?为什么打印数组的大小为零?

function test() {
  var arr = [];
  for(var i = 0; i < 10; i++)
  {
    console.log('i ->' + i);
    arr.push[i];
  }
  console.log('\n' + 'array length :' + arr.length);
}
Run Code Online (Sandbox Code Playgroud)

-

输出:

i ->0
i ->1
i ->2
i ->3
i ->4
i ->5
i ->6
i ->7
i ->8
i ->9

array length :0
Run Code Online (Sandbox Code Playgroud)

-

打印为零(0)

javascript node.js

0
推荐指数
1
解决办法
90
查看次数

标签 统计

c++ ×3

javascript ×1

memory-management ×1

node.js ×1