小编sac*_*sac的帖子

Php中根据特殊字符分解字符串

我有一个字符串:

xyz.com?username="test"&pwd="test"@score="score"#key="1234"
Run Code Online (Sandbox Code Playgroud)

输出格式:

array (
    [0] => username="test"
    [1] => pwd="test"
    [2] => score="score"
    [3] => key="1234"
)
Run Code Online (Sandbox Code Playgroud)

php explode special-characters

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

使用stl c ++对数字使用绝对值进行排序

我正在尝试使用 stl sort 函数根据绝对值对给定数组进行排序,但它没有按指定顺序排序:我编写的代码:

int fun(int i,int j)
{
    if(abs(i)<abs(j))
        return j;
    else
        return i;
}

int main()
{
    int arr[100000];
    int i,n;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>arr[i];
    sort(arr,arr+n,fun);

    int diff=1000000ll;
    int x=0;
    int y,z;

    for i 0 to n
       cout<<arr[i];
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ sorting stl absolute-value

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

标签 统计

absolute-value ×1

c++ ×1

explode ×1

php ×1

sorting ×1

special-characters ×1

stl ×1