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

鍍金池/ 問(wèn)答/ C++問(wèn)答
夕顏 回答

ISO C 標(biāo)準(zhǔn)中寫(xiě)到

6.3.1.3 Signed and unsigned integers

When a value with integer type is converted to another integer type
other than _Bool, if the value can be represented by the new type, it
is unchanged. Otherwise, if the new type is unsigned, the value is
converted by repeatedly adding or subtracting one more than the
maximum value that can be represented in the new type until the value
is in the range of the new type. Otherwise, the new type is signed and
the value cannot be represented in it; either the result is
implementation-defined or an implementation-defined signal is raised.

換句話說(shuō),unsigned char 的表示范圍是 [0, 255],不能表示 -1,于是將 -1 加上 256 得到 255。

如果是把 signed char 型 -1 轉(zhuǎn)成 unsigned int,則用 -1 加上 4294967296 得到 4294967295。

對(duì)硬件來(lái)說(shuō),從有符號(hào)到無(wú)符號(hào)的轉(zhuǎn)換就是簡(jiǎn)單地在前面補(bǔ)符號(hào)位或者直接截?cái)唷?/p>

玄鳥(niǎo) 回答

以前沒(méi)有遇到過(guò)這個(gè)問(wèn)題,我實(shí)驗(yàn)了一下,覺(jué)得原因應(yīng)該是:

  1. 父級(jí)容器上設(shè)置overflow、overflow-y和overflow-x屬性不為visible時(shí),會(huì)觸發(fā)一次容器寬高計(jì)算并裁剪
  2. box-shadow屬性不會(huì)影響元素的寬高,所以被overflow忽略,然后裁剪
  3. 由于設(shè)置了overflow,父級(jí)元素觸發(fā)BFC,沒(méi)有上外邊距合并,所以能夠顯示上邊的box-shadow

事實(shí)上,overflow不為visible與觸發(fā)BFC的條件很像,但不清楚是不是BFC的原因。

以上都是在chrome瀏覽器中發(fā)現(xiàn)的情況,因此可以試試上面兩位的解決方法。

但是

但是,如果你是在IE9瀏覽器中,那么僅僅是1px的margin是沒(méi)有辦法完整顯示box-shadow的,至少得是2px。

吢涼 回答

new是再堆上開(kāi)內(nèi)存,除非整個(gè)進(jìn)程結(jié)束,這時(shí)候會(huì)被操作系統(tǒng)回收,不然的話函數(shù)結(jié)束后內(nèi)存里的變量還在的

懶豬 回答

Remarks

The color format of the bitmap created by the CreateCompatibleBitmap function matches the color format of the device identified by the hdc parameter. This bitmap can be selected into any memory device context that is compatible with the original device.
Because memory device contexts allow both color and monochrome bitmaps, the format of the bitmap returned by the CreateCompatibleBitmap function differs when the specified device context is a memory device context. However, a compatible bitmap that was created for a nonmemory device context always possesses the same color format and uses the same color palette as the specified device context.
Note: When a memory device context is created, it initially has a 1-by-1 monochrome bitmap selected into it. If this memory device context is used in CreateCompatibleBitmap, the bitmap that is created is a monochrome bitmap. To create a color bitmap, use the HDC that was used to create the memory device context

MSDN 里說(shuō)了CreateCompatibleBitmap創(chuàng)建的是monochrome(單色的)

耍太極 回答

PYTHON

lala = [1,1,1,2,3,4,5,8,10,22,24,25,26,66]
res = []
tmp = [lala[0]]
for i in range(1, lala.__len__()):
    if lala[i] - lala[i-1] == 1:
        tmp.append(lala[i])
    else:
        if len(tmp) == 1:
            res.append(tmp[0])
            tmp = [lala[i]]
        else:
            res.append(tmp)
            tmp = [lala[i]]

print(res)
荒城 回答

輸出整數(shù)的時(shí)候,%.n表示最少顯示n位數(shù)字。

枕頭人 回答

在 C++ 中,除了 ASCII 字符外的字符為寬字符,需要使用 L 標(biāo)識(shí)。而寬字符流有特定的輸出流,為 std::wcout。所以,正確的輸出方式為 std::wcout << L"你好" << std::endl。

另外,還需要涉及到 std::locale 的概念。std::locale 代表地域各個(gè)設(shè)定的集合。locale 文檔

每個(gè)輸入輸出流可以與一個(gè) std::locale 進(jìn)行綁定,默認(rèn)綁定為 std::locale("C")。此處使用 std::wcout.imbue( locale ),需要設(shè)定的地域?yàn)?zh-cn,我沒(méi)有查到相關(guān)的內(nèi)容,這個(gè)地域字符串可能跟環(huán)境有關(guān)系。

最終代碼為:

#include <cstdio>
#include <locale>
#include <string>
#include <iostream>

int main() {
    auto old_locale = std::wcout.imbue(std::locale("zh-cn"));
    std::wcout << L"你好" << std::endl;

    std::cout << "old locale: " << old_locale.name() << std::endl;
    auto new_locale = std::wcout.imbue(old_locale);
    std::cout << "new locale: " << new_locale.name() << std::endl;

    printf("你好\n");

    system("pause");
}

輸出為:

你好
old locale: C
new locale: zh-cn
你好

這部分內(nèi)容較繁雜,我也沒(méi)有很了解,希望能對(duì)你有幫助。

凝雅 回答

大致上跟其它編譯到機(jī)器碼的語(yǔ)言一樣:別人只能看匯編了。

不過(guò),「故考慮把核心部分換語(yǔ)言重構(gòu)」,如果你考慮在同一進(jìn)程里同時(shí)使用 Go 和另一種語(yǔ)言,特別是解釋型語(yǔ)言的話,還是放棄吧。Go 和 C 之間的調(diào)用已經(jīng)被 Go 核心開(kāi)發(fā)者警告了(請(qǐng)搜索「cgo is not go」;你沒(méi)看到 Go 語(yǔ)言的項(xiàng)目都是自個(gè)兒干活,極少有混編的情況),和其它大運(yùn)行時(shí)的程序調(diào)……你饒了你自己吧。

出于代碼保護(hù)目的,建議使用 Rust,和 Python、Ruby、Lua、NodeJS、Haskell、C、C++ 等等語(yǔ)言相互調(diào)用都容易得多。

局外人 回答

動(dòng)態(tài)鏈接的地址是在運(yùn)行時(shí)確定的,因此編譯連接階段不需要用到動(dòng)態(tài)鏈接庫(kù)中函數(shù)的地址。之所以需要在編譯連接階段引入動(dòng)態(tài)鏈接庫(kù),主要是為了確定要連接的符號(hào)名,這樣才能在運(yùn)行時(shí)根據(jù)符號(hào)名找到對(duì)應(yīng)的函數(shù)入口。

吃藕丑 回答

<?php

public function b($arr = array()) {
    if (!empty($arr)) {
        return "";
    } else {
        foreach ($arr as &$v) {
            if (is_array($v)) {
                $v = $this->b($v);
            } else {
                $v = $v + 1;
            }
        }
        return $arr;
    }
}

?>

溫衫 回答

兩種情況:
1,同步函數(shù)

這個(gè)簡(jiǎn)單,順序執(zhí)行就可以了

2,異步函數(shù)(我猜你是這種情況)async await可以解決

async function a() {
    return Promise.resolve("a");
}
async function b() {
    return Promise.resolve("b");
}
async function c() {
    await a();
    await b();
    console.log('執(zhí)行c')
}
c();
情殺 回答

在配置文件里面,設(shè)置代理服務(wù)器不要配置

背叛者 回答

用數(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)

逗婦惱 回答

https://www.cnblogs.com/yingp...
這個(gè)有個(gè)JAVA代碼,你可以參考下。我一開(kāi)始是用C寫(xiě)的,感覺(jué)太麻煩了,JAVA不太會(huì),但是看懂了一點(diǎn),希望可以幫到你

玩控 回答

其實(shí)這個(gè)問(wèn)題,很簡(jiǎn)單,分析一下就知道了。分析如下:

var str = "我是/@小王@\\和/@小李@\\的好朋友"

你要轉(zhuǎn)成

  var arr = [{"text": "我是"}, {"name": 小王"}, {"text": "和"}, {"name": "小李"}, {"text": "的好朋友"}]

以我看來(lái)就是,通過(guò)/@和@\把字符串分割,并且以/@結(jié)尾的放到text屬性中,以@\結(jié)尾的放到name中,并且保持原有順序。
既然是有兩個(gè)分割字符,那么我們就分割兩次。我簡(jiǎn)單寫(xiě)了一下,但是沒(méi)有做太多檢驗(yàn)和判斷?;仡^你對(duì)參數(shù)做下校驗(yàn)。

我的代碼如下:

var str = "我是/@小王@\\和/@小李@\\的好朋友";
    var strs = str.split("/@");
    var arr = new Array();
    for (var i = 0 ;i < strs.length;i++)
    {
        if(strs[i].indexOf('@\\') != -1)
        {
            var temps = strs[i].split('@\\');
            for(var j=0;j<temps.length;j++)
            {
                if(j == temps.length -1)
                {
                    var text =
                    {
                        text:temps[j]
                    }
                }else
                {
                    var name =
                    {
                        name:temps[j]
                    }
                }
            }
        }else
        {
            var text =
            {
                text:strs[i]
            }
        }
        if(name != null && '' != name && 'undifined' != name)
        {
            arr.push(name);
        }
        if(text != null && '' != text && 'undifined' != text)
        {
            arr.push(text);
        }
    }
    console.log(arr);
那么,最后控制臺(tái)輸入如下:

圖片描述

如果沒(méi)問(wèn)題,請(qǐng)采納,謝謝。

挽歌 回答

If the two signatures are the same, it is not possible. So, the first solution: add one more tag in parameter list, like

struct Foo
{
    struct Path {};
    struct NonPath {};
    foo(std::string, Path) { /* ... */ }
    foo(std::string, NonPath) { /* ... */ }
};
int main()
{
    // ...
    auto f1 = foo(s1, Foo::Path);
    auto f2 = foo(s2, Foo::NonPath);
    return 0;
}

Of course, you can also create two different Classes.

The two solutions above will be subtle if you have more constructors. Best practice is
Named Constructor Idiom:

struct Foo
{
private:
    std::string str;
    Foo(std::string s) : str(s) {}
public:
    static Foo path(std::string s) { /* ... */ return Foo(s); }
    static Foo non_path(std::string s) { /* ... */ return Foo(s); }
};
int main()
{
    // ...
    auto f1 = Foo::path(s1);
    auto f2 = Foo::non_path(s2);
    return 0;
}

提供幾種思路:
(1)將包含 N 個(gè)數(shù)的數(shù)組打亂,然后選取前 10 個(gè)數(shù)。
(2)將每次得到的數(shù)放入 HashSet,下次取得一個(gè)數(shù)時(shí)先判斷是否存在于 Set 當(dāng)中,直到當(dāng) Set 的 size 為 10 時(shí)結(jié)束。