Problem: Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Summary: 不使用+和-符号,计算两个整型数之和。 Analysis: XOR相当于 ...
分类:
其他好文 时间:
2016-10-23 07:38:34
阅读次数:
180
重载运算符实质是编写一个执行相应操作的函数,当运算符被使用时,实质是函数被调用,这是编译器完成的转换工作。 重载的运算符函数,都有个特殊的函数名:operator【运算符】。operator为关键字。 如重载加法运算符: operator+ 乘法运算符: operator* C++支持运算符重载,使 ...
分类:
编程语言 时间:
2016-10-23 02:17:32
阅读次数:
303
A、B是两个n*n的矩阵,计算C=A*B。 传统算法: 按照下面公式计算,需要n3次乘法和n3-n2次加法,时间复杂度为Θ(n3)。 递归算法: 假定n为2的幂,将A、B、C分成4个大小为(n/2)*(n/2)的子矩阵。 用分治法来计算C。需要8次(n/2)*(n/2)矩阵的乘法和4次(n/2)*( ...
分类:
其他好文 时间:
2016-10-22 18:08:11
阅读次数:
253
#include<iostream>#include<string>using namespace std; class Elements{ private: int value; static int numberOfObjects; public: Elements(); Elements(co ...
分类:
其他好文 时间:
2016-10-22 15:05:33
阅读次数:
241
#include <iostream>#include <vector>#include <algorithm>using namespace std; class Student{ public: Student(string _name, int _score) { name = _name; ...
分类:
其他好文 时间:
2016-10-22 14:59:07
阅读次数:
120
#include<iostream>#include<string>#include<cstring>using namespace std;class String { public: String(); // str = "" String(const char*); // str = "abc ...
分类:
其他好文 时间:
2016-10-22 14:58:02
阅读次数:
192
#include<iostream> using namespace std; class Complex //复数类 { public: Complex(double real = 0, double imag = 0); Complex operator+(Complex& com); Comp ...
分类:
其他好文 时间:
2016-10-22 14:40:08
阅读次数:
149
安装好mysql后,想使用另一个电脑进行远程登录,在登录时 提示拒绝连接 百度后,发现需要两个步骤解决该问题 /etc/mysql/my.cnf 里修改bind_address = 0.0.0.0 进行授权 (1)直接授权 (2)改表法 可能是你的帐号不允许从远程登陆,只能在localhost。这个 ...
分类:
数据库 时间:
2016-10-22 00:09:01
阅读次数:
216
http://www.haorooms.com/post/bower_error 第一次使用bower,结果在安装bootstrap时遇到这个问题: $ bower install bootstrap bower ENOGIT git is not installed or not in the P ...
分类:
其他好文 时间:
2016-10-21 13:13:10
阅读次数:
155
增强的Function构造函数(Increased Capabilities of the Function Constructor) 在Javascript中Function构造函数可以让你创建一个新函数,不过这个功能并不经常使用。Function构造函数接收函数参数和函数体作为参数,参数都必须是 ...
分类:
其他好文 时间:
2016-10-21 13:06:44
阅读次数:
128