- 博客(23)
- 资源 (13)
- 收藏
- 关注
原创 c++ 通用类型
c++ 通用类型 类似any实现:#include <iostream>#include <typeinfo>using namespace std;class __base_type {public: virtual const char* get_id_name()=0;//验证类型名称};/*!* \class real_type** \brief 数据实体:需要使用
2016-04-14 20:28:20
3929
翻译 PhysicsJS
JS物理引擎库。瞬间让虚拟世界变得真实。http://flippinawesome.org/2013/12/02/building-a-2d-browser-game-with-physicsjs/原文地址步骤0:虚无的空间在一切的开始。我们需要设置我们的html。我们使用HTML cavas来渲染。所以从你的标准HTML5模板开始。我假设scripts在body的末尾加载
2014-03-27 12:50:47
1866
原创 C++类
C++中类以class 关键字声明class MyClass{public:int s;};值得注意到是在末尾要加上;数据结构:权限public公共:内外都可调用protect内部或其子类中调用private仅仅内部静态数据为该类的公共数据,也就是该类的所有变量的该数据都相同。友元函数:cla
2013-08-24 11:00:53
657
原创 类的构造与析构
class T{public: int n[1000]; char w; T():pre(0),next(0){ w='0'; ::memset(n,0,1000);cout<<w<<":creat\n";} T(char name):pre(0),next(0){ w=name;cout ~T(){ cout<<w<<":delete\n"; if(pre) {//pr
2013-08-24 10:55:34
903
原创 类的构造与析构
class T{public:int n[1000];char w;T():pre(0),next(0){ w='0';::memset(n,0,1000);cout~T();if(next) next->~T ();cout<<w<<":delete\n";}T* pre;T* next;T operator +(T& a){ T* t=new T('n');t->pre=this;t->n
2013-08-24 10:20:20
779
原创 #define and typedef
#define 是文本替换,在编译时编译器自动替换。 typedef 就是type define类型定义,是一种更安全的替换。基本用法typedef int; INT; #define INT int2者差异出来了,首先是别名位置上的差异,再是typedef是一个语句,需要;是程序的一部分,而#define是告诉编译器的。以前我以为这只是小事,换个名字而已所以没好好学过。但事实
2013-08-24 10:17:04
836
转载 volatile关键字
volatile的本意是“易变的” volatile提醒编译器它后面所定义的变量随时都有可能改变,因此编译后的程序每次需要存储或读取这个变量的时候,都会直接从变量地址中读取数据。如果没有volatile关键字,则编译器可能优化读取和存储,可能暂时使用寄存器中的值,如果这个变量由别的程序更新了的话,将出现不一致的现象。http://www.cnblogs.com/yc_sun
2013-08-19 14:34:46
552
原创 C中的位操作
先介绍下位运算符:位与:&(只有2个true时为true); 位或 :|(只有2个false时为false);位异或: ^(2个不一样时为true);位反:~ ;还有左移动>;再介绍个关键字register 这个意思是吧变量存到寄存器上提高读取速度。我想位运算都是快捷的,也该用快捷的变量。位运算的妙用:异或操作的性质:满足结合律和交换律。a^a=0;a^0=a;2个
2013-08-19 14:16:29
690
原创 string的使用
string类型的原型为char ,加入各种功能成为一个类。可以很方便的s1+s2+"asd"进行这类简单明了的操作。(这绝对是C++的优势)。在成员函数上,基本和向量容器vector一样。在实际运用中最头痛的莫过数据转化了。string 转 char * string s;strcpy(char*,s.c_str());char 转stringstring t;
2013-08-06 14:45:15
677
原创 ThreeColorabilityEasy
Problem Statement There is a H times W rectangle divided into unit cells. The rows of cells are numbered 0 to H-1 from top to bottom, and the columns are numbered 0 to W-1 from left to ri
2013-08-06 14:01:07
807
原创 InsertZ
Problem Statement You are given two strings: init and goal. Bothinit and goal contain lowercase letters only. Additionally,init does not contain the character 'z'. Your goal is to t
2013-08-06 10:49:19
1564
原创 C:各种数据转化
原型: int atoi(const char *nptr); 函数说明: 参数nptr字符串,如果第一个非空格字符不存在或者不是数字也不是正负号则返回零,否则开始做类型转换,之后检测到非数字(包括结束符 \0) 字符时停止转换,返回整型数。
2013-07-24 09:15:13
733
原创 SRM 558 backup 1div 1
Problem Statement There are some red points and blue points on the Cartesian plane. All red points are on the x-axis and all blue points are in the upper half-plane. That is, the y-coordina
2012-12-16 07:47:26
593
原创 SRM559
Problem Statement In the Land of Winter lives the Toy King. The Toy King owns many fields and in each field he has control over different plots of land. The Toy King also has nine lords und
2012-11-17 22:11:33
492
原创 srm 558 backup 1 DIV 2
Problem Statement Cat and Rabbit are going to play the following game.There are some tiles in a row. Each of the tiles is colored white or black. You are given a stringtiles, describing
2012-10-28 08:43:16
503
原创 算法连载6
Problem Statement Little Fox Jiro has a rectangular board. On the board there is a row of N unit cells. The cells are numbered 0 through N-1 from the left to the right. Initially, the cells
2012-10-27 16:45:16
539
原创 算法连载5:
Problem Statement Surrounding Game is a single-player game played on a rectangular grid of cells. Cells are considered adjacent if they share a common side. (Hence, each cell has at most fo
2012-10-20 16:48:33
402
原创 算法连载4
Problem Statement You just bought a very delicious chocolate bar from a local store. This chocolate bar consists of N squares, numbered 0 through N-1. All the squares are arranged in a singl
2012-10-04 15:10:02
481
原创 算法连载3
Problem Statement You have N balls, where N is odd. The balls are numbered from 0 to N-1. In that order, they are arranged into a row going from the left to the right.In addition to the
2012-10-04 07:31:41
410
原创 million contestants:算法分析
Problem Statement Exactly one million contestants, numbered 1 through 1,000,000, took part in a programming contest. The rules of the contest are simple: the winner is the contestant who
2012-09-22 18:07:27
529
原创 算法连载2:跳蚤问题
今天的算法是个1000Points的。Problem Statement The amazing flea circus Nehryzma is in town! The most famous act of this flea circus looks as follows: On the table there are N marked s
2012-09-16 14:21:16
869
原创 物体与曲面的碰撞
我在做一个小游戏,需要一些碰撞,于是我就想了一个算法:把圆边缘与曲线的碰撞转化为 圆心与地形的碰撞。首先我的物体是圆形的,当然其他图形也可以用圆近似代替或分割。 地形曲面是任意的,我的程序是用函数表达的。如图,圆下落时不能直接知道接触点的位置,因此我的算法主要是得到近似的触点。如果把地形函数f(x)延斜率方向 延长r,得到一个新的函数g(x).g(x)与圆心的相交足以说
2012-06-17 13:39:22
740
安卓H5技术通讯录
2016-04-24
c++通用类型
2016-04-15
学生成绩管理系统设计实验
2016-01-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人