在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ C++問答
背叛者 回答

用數(shù)組的reduce方法
let arr = [[1, 2], [3, 4], [5, 6]]
let list = []
arr.reduce((pre, current, index, arr) => {

list = []
for (let i = 0; i < pre.length; i++) {
    for (let j = 0; j < current.length; j++) {
        list.push(+(pre[i] + '' + current[j]))
    }
}
return list

})

console.log(list)

紓惘 回答

樹形結(jié)構(gòu),網(wǎng)上有很多參考案例
參考鏈接

離夢 回答

由于你沒有給出錯(cuò)誤提示,無法判斷錯(cuò)誤的具體原因。

考慮到Account只授予了std::vector<Account>訪問權(quán)。一個(gè)可能得原因是在std::vector<Account>內(nèi)對Account的構(gòu)造是由另一個(gè)類/函數(shù)完成的,比方說std::allocator<Account>。

class Account
{
    friend std::vector<Account>::allocator_type;
public:
    Account(const char *, double = 0.0);
private:
    Account() {}
};
喵小咪 回答

問題已經(jīng)解決

結(jié)構(gòu)體中定義的是 string 類型,string 的長度可以是 3 或者6 任意長度,導(dǎo)致結(jié)構(gòu)體占用空間大小不確定。

熊出沒 回答

1.cd到redis文件夾,找到redis.conf
2.把daemonize設(shè)置為yes
3.輸入./redis-server ../redis.conf 這個(gè)路徑不確定根據(jù)個(gè)人的實(shí)際安裝情況而定,反正就是找到redis-server的路徑 以redis.conf的路徑啟動(dòng)

妖妖 回答

我有用過這個(gè),你不要用他那個(gè)數(shù)據(jù)來平均等分,而是用另一種方法,比如你的有9份,有3種顏色,那就是分成3份,我目前知道的就這樣解決,我也沒有找到整數(shù)的api??傊阋昧硪环N方法給他搞成整數(shù)。

哚蕾咪 回答

釋放部分沒錯(cuò)。

free(row);
row = NULL;
free(col);
col = NULL;

這段代碼的問題是 malloc 之后沒有 memset。

撥弦 回答

收到RST的socket,第一次觸發(fā)可讀,read返回-1并設(shè)置errno,不close得話,繼續(xù)觸發(fā)可讀,再read便會(huì)返回0。

祉小皓 回答

可以去看一下二叉樹的遞歸,相信應(yīng)該有幫助

舊顏 回答
const http = require('http');
var querystring = require('querystring');
const postData = JSON.stringify(
    {
        "body":
          {
            "content":"拜訪",
            "visitor_name":"李四",
            "visitor_company_name":"",
            "check_in_plcae":"南京",
            "visitor_type":"02",
            "host":"01",
            "visitor_num":"11",
            "photo":""
          }
      }
  );
  console.log(postData);
  
  const options = {
    hostname: '',
    port: 8089,
    path: '',
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Content-Length': Buffer.byteLength(postData)
    }
  };
  
  const req = http.request(options, (res) => {
    console.log(`狀態(tài)碼: ${res.statusCode}`);
    console.log(`響應(yīng)頭: ${JSON.stringify(res.headers)}`);
    res.setEncoding('utf8');
    res.on('data', (chunk) => {
      console.log(`響應(yīng)主體: ${chunk}`);
    });
    res.on('end', () => {
      console.log('響應(yīng)中已無數(shù)據(jù)。');
    });
  });
  
  req.on('error', (e) => {
    console.error(`請求遇到問題: ${e.message}`);
  });
  
  // 寫入數(shù)據(jù)到請求主體
  req.write(postData);
  req.end();

最后我通過這種方式發(fā)送了過去

練命 回答

1、PHP對遞歸是有限制的,遞歸次數(shù)過多就會(huì)出現(xiàn)溢出報(bào)錯(cuò)。
2、在理論上,所有的遞歸都可以用循環(huán)替代。
3、生成HTML樹的難點(diǎn)在于html的閉合標(biāo)簽如:</ul>。

可以參考:PHP無限級分類的實(shí)現(xiàn)(不使用遞歸) http://www.cnblogs.com/rainma...

久舊酒 回答

void fun(int *q,int *p,int *w);修改的是指針指向的內(nèi)容(a, b, c)。void fun_(int *q,int *p,int *w);修改的是指針本身,而不是指向的內(nèi)容。

void butler();多了個(gè)分號

傻叼 回答

在C++里使用C庫的函數(shù)時(shí),你加了 extern "C" { } 嗎? 否則就會(huì)鏈接找不到。

來守候 回答

C++的話可以使用GetAdaptersInfo函數(shù)來獲取相關(guān)網(wǎng)卡信息。
提供一個(gè)實(shí)例鏈接(實(shí)例存在內(nèi)存泄露):鏈接描述

官方實(shí)例:鏈接描述

grid[i] 是個(gè)int* 不錯(cuò),但是你的grid[i]指向哪里了你?你沒有為它分配內(nèi)存。

函數(shù)傳入的grid有什么意義呢?

離夢 回答

看少俠這代碼,RoomBusiness這個(gè)類應(yīng)該是以單例模式寫的吧,所以兩種方法沒區(qū)別

怪痞 回答

C++標(biāo)準(zhǔn)只規(guī)定了編譯器可以幫我們把一個(gè){}定義的常量數(shù)組轉(zhuǎn)換為一個(gè)initializer_list對象,這樣接受initializer_list為參數(shù)的函數(shù)(通常是各種構(gòu)造函數(shù)),就可以接受{},通過這種方式擴(kuò)展了語法,使我們可以像初始化普通數(shù)組那樣初始化容器,簡化了代碼。

但不要把initializer_list當(dāng)做一個(gè)普通的(容器)來用。

在GCC(4.8)的實(shí)現(xiàn)版本里,initializer_list的構(gòu)造函數(shù)被實(shí)現(xiàn)為private。除了通過{}讓編譯器幫你構(gòu)造,你不能構(gòu)造一個(gè)有效的initializer_list。

namespace std
{
  /// initializer_list
  template<class _E>
    class initializer_list
    {
    public:
      typedef _E                value_type;
      typedef const _E&         reference;
      typedef const _E&         const_reference;
      typedef size_t            size_type;
      typedef const _E*         iterator;
      typedef const _E*         const_iterator;

    private:
      iterator                  _M_array;
      size_type                 _M_len;

      // The compiler can call a private constructor.
      constexpr initializer_list(const_iterator __a, size_type __l)
      : _M_array(__a), _M_len(__l) { }

    public:
"/usr/include/c++/4.8/initializer_list" [readonly] 107 lines --17%--                   

在VC++ 2017的的實(shí)現(xiàn)版本里,initializer_list的構(gòu)造函數(shù)是public。

constexpr initializer_list(const _Elem *_First_arg,
        const _Elem *_Last_arg) _NOEXCEPT
        : _First(_First_arg), _Last(_Last_arg)
        {    // construct with pointers
        }

所以下面的代碼在VC++2017上是ok的:

#include <iostream>

void test(std::initializer_list<int> lst) {
    for (auto l : lst)
        std::cout << l << std::endl;
}

int main() {
    int a[] = { 1, 2, 3, 4 };

    test({ 1, 2, 3, 4 }); // c++ standard 

    test(std::initializer_list<int>(a, a + 4)); // compile error in gcc 4.8 but ok in vc++2017

    return 0;
}

但這是不被保證的。

C++通過庫代碼配合編譯器的方式支持了一種新的語法,這可能是讓人容易困惑的原因。

維他命 回答

1.剛買的這臺(tái)機(jī)器磁盤還用分區(qū)嗎?
不需要,直接使用即可

2.如果要分區(qū),大概要怎么來分區(qū)呢?
忽略

3.如果不用分區(qū),對以后磁盤擴(kuò)容會(huì)有什么影響嗎?
一般服務(wù)器無非就是一些日志,一般40G也夠用了,如果你服務(wù)器需要存儲(chǔ)大量文件,建議你使用OSS文件存儲(chǔ);
當(dāng)然阿里云的服務(wù)器你也是可以之后購買磁盤進(jìn)行擴(kuò)容,沒有任何壓力。