小编Ser*_*gey的帖子

所有标准C++功能都可以在C++/CLI中使用吗?

如果我只是在C++/CLI程序中包含现有的标准C++类,它会起作用吗?

在我的测试中,一切都很顺利,但每个程序都是如此吗?

.net c++ c++-cli

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

我怎么知道数据库中是否存在这样的值?(ADO.NET)

例如,我有一个表,并且有一个名为"Tags"的列.我想知道此列中是否存在值'编程'.我怎么能在ADO.NET中这样做?

我这样做了:

OleDbCommand cmd = new OleDbCommand("SELECT * FROM table1 WHERE Tags='programming'", conn);
OleDbDataReader = cmd.ExecuteReader();
Run Code Online (Sandbox Code Playgroud) 接下来我该怎么办?

.net c# sql database ado.net

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

Function pack()返回0

为什么这样的代码可以pack('i',6)返回0?

所有php.net都说这个函数的返回值:

返回包含数据的二进制字符串.

php pack

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

比较Python中的字符串和数字

可能重复:
Python如何比较字符串和int?

为什么下面的部分表现得像它的表现?

>>> '10' > 100
True
>>> 100 < '10'
True
Run Code Online (Sandbox Code Playgroud)

它不应该引发例外吗?

python string comparison numbers

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

运算符/重载

出于学习目的,我正在用C++创建大整数类.有2个文件:

big_int.h

#ifndef BIG_INT_H
#define BIG_INT_H

#include 

class big_int
{
public:
    big_int(void);
    big_int(char*);
    big_int(QString);

    ~big_int();

    big_int operator+(big_int);
    big_int operator-(big_int);
    big_int operator*(big_int);
    big_int operator/(big_int);
};

#endif // BIG_INT_H
Run Code Online (Sandbox Code Playgroud)


big_int.cpp


#include "big_int.h"

big_int::big_int()
{
}

big_int::big_int(QString str)
{
}

big_int::~big_int()
{
}

big_int operator+(big_int b)
{
    return big_int();
}

big_int operator-(big_int b)
{
    return big_int();
}

big_int operator*(big_int b)
{
    return big_int();
}

big_int operator/(big_int)
{
    return big_int();
}
Run Code Online (Sandbox Code Playgroud)

Qt Creator返回:C:/ Documents and Settings/Admin/My Documents/calculator_1_0/big_int.cpp:31:error:big_int operator /(big_int)必须带两个参数.但是operator /只需要1个参数.怎么了?

c++ operator-overloading

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

HashTable是否存在任何通用版本?

我需要一个像C++ std :: map一样工作的类.更具体地说,我需要这样的行为:
map< string, vector<int> > my_map;
这可能吗?

c# c++ hashtable stdmap

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

如何避免在每个.cs文件中使用多个运算符?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
Run Code Online (Sandbox Code Playgroud)

我必须将上面的代码放在几乎每个.cs文件中.有什么办法可以避免吗?

c# using-directives

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

Ruby的.push和<<之间的区别

这是推送的一个例子:

@connections = Hash.new []
@connections[1] = @connections[1].push(2)
puts @connections # => {1=>[2]}
Run Code Online (Sandbox Code Playgroud)

这是<<的一个例子

@connections = Hash.new []
@connections[1] << 2
puts @connections # => {}
Run Code Online (Sandbox Code Playgroud)

由于某种原因,输出(@connections)是不同的,但为什么呢?我猜它与Ruby对象模型有关?

也许新的哈希对象[]每次都在创建,但是没有保存?但为什么?

ruby

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