创建一个新的指针,首先要赋值,然后在用之前一定要申请地址。即 int *p = NULL; p = new int;void指针 void *p 可以与任意指针类型相互赋值。常量限定符const1)指向常量的指针:const int *p = &x;//可以修改指针指向的地址,但不能修改他指向的内容...
分类:
其他好文 时间:
2014-07-06 15:50:29
阅读次数:
184
QAbstractItemModelQAbstractItemModel是一个抽象类,该抽象类未实现的纯虚方法有QModelIndex QAbstractItemModel::index(int row, int column, const QModelIndex & parent = QModel...
分类:
其他好文 时间:
2014-07-06 13:26:45
阅读次数:
228
templateint binarySearch(const vector &a, const comparable &x){ int low = 0, high = a.size() - 1; while(low a[center]) low = center ...
分类:
其他好文 时间:
2014-07-06 13:10:01
阅读次数:
188
// First program example#import int main (int argc, const char * argv[]) { @autoreleasepool { NSLog (@"Programming is fun!"); } return...
分类:
其他好文 时间:
2014-07-06 13:03:34
阅读次数:
177
一、打开或创建一个文件
#include
int open(const char *pathname, int oflag, .../*mode_t mode*/);
返回值:若成功则返回文件描述符,若出错则返回-1
oflag选项:
O_RDONLY
O_WRONLY
O_RDWR
以上三个常量中必须指定一个,且只能指定一个。
以下常量都是可选的:
O_AP...
分类:
其他好文 时间:
2014-07-06 12:17:24
阅读次数:
158
#include
#include
#include
#include
#include
#include
using namespace std;
const int maxn = 3010;
const int INF = 1<<28;
int dx[maxn], dy[maxn];
int cx[maxn], cy[maxn];
vector G[maxn];
int dis;...
分类:
其他好文 时间:
2014-07-06 11:39:26
阅读次数:
199
题意:有n个灯笼,第一个的高度是A,最后一个是B,灯笼的关系给出,并要求每个灯笼的高度是非负数的,求最低的B
思路:推出公式:H[i]=2*H[i-1]+2-H[i-2],然后枚举H[2],在知道H[1]的情况下就能求出所有的高度,然后判断是否都是非负数
#include
#include
#include
#include
using namespace std;
const int...
分类:
其他好文 时间:
2014-07-06 11:15:54
阅读次数:
122
又出错了。。
main.obj:-1: error: LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall MyView::metaObject(void)const " (?metaObject@MyView@@UBEPBUQMetaObject@@XZ)
main.obj:-1: error: L...
分类:
其他好文 时间:
2014-07-06 09:07:57
阅读次数:
300
这次基本上没出大的错误。。根据按键向下的功能实现了一下向上的功能,还有旋转rotate()功能
myitem.h
#ifndef MYITEM_H
#define MYITEM_H
#include
class myItem : public QGraphicsItem
{
public:
myItem();
QRectF boundingRect() const;
...
分类:
其他好文 时间:
2014-07-06 09:03:18
阅读次数:
227
刘汝佳的题目,悲剧文本 -_-|||
这里使用vector容器倒置记录数据,然后从后面输出就可以了。
难度就是不知道这样的文档到底哪里是开始输出,故此使用动态管理内存的容器比较好做。
增加了io处理的O(n)算法也没有上榜,郁闷。
#include
#include
#include
using std::vector;
using std::string;
const int M...
分类:
其他好文 时间:
2014-07-06 00:27:31
阅读次数:
283