- 博客(224)
- 收藏
- 关注
原创 lua userdata
#include <stdio.h>#include <string.h>#include <limits.h>extern "C"{ #include "lua.h" #include "lauxlib.h" #include "lualib.h"}#define BITS_PER_WORD (CHAR_BIT*sizeof(int))#define I_WORD(i) ((unsigned int)(i))/BITS_PER_W...
2022-01-21 10:48:55
285
原创 Effective STL:第六条:C++烦人的分析机制
#include <iostream>#include <vector>#include <iterator>#include <algorithm>#include <list>#include <fstream>using namespace std;int main(){ ifstream dat...
2018-12-03 14:21:38
378
原创 cocos2dx lua 屏蔽下层按钮事件
local function onTouch(eventType, x, y) return true end self:setTouchEnabled(true) self:registerScriptTouchHandler(onTouch)
2018-04-24 11:22:33
1400
原创 键盘事件,自定义事件
/** * Created by cena on 2017/4/4. */var MyLayer=cc.Layer.extend({ _topDisplayLabel:null, _item1Count:null, ctor:function() { this._super(); var size=cc.winSize;
2017-04-07 01:09:38
480
原创 cocos-js button点击事件
/** * Created by Tomas on 2017/4/5. */var MyLayer=cc.Layer.extend({ _topDisplayLabel:null, ctor:function() { this._super(); var button =new ccui.Button(); butto
2017-04-05 20:50:20
3913
原创 cocos-js触摸事件
/** * Created by cena on 2017/4/4. */var MyLayer=cc.Layer.extend({ ctor:function() { this._super(); var size=cc.winSize; var man=new cc.Sprite(res.HelloWorld_png);
2017-04-05 00:56:18
1887
原创 cocos-js 动作
/** * Created by cena on 2017/4/4. */var MyLayer=cc.Layer.extend({ ctor:function() { this._super(); var size=cc.winSize; var man=new cc.Sprite(res.HelloWorld_png);
2017-04-04 22:51:24
419
原创 带输出参数的存储过程
IF EXISTS(SELECT *FROM sysobjects WHERE id=OBJECT_ID('Student_name'))DROP PROCEDURE Student_nameCREATE PROCEDURE Student_name(@mid CHAR(10),@Name CHAR(50) out, --out输出参数@total_score int OUT --)
2017-03-21 09:56:17
570
原创 连接查询,视图
表Member:表F:表score:内连接查询:SELECT Mname,Fname,Score FROM Member INNER JOIN score ON Member.MID=score.MID INNER JOIN F ON F.FID=score.FID视图的创建,查询IF EXISTS(SELECT *FROM syso
2017-03-20 09:57:47
2555
原创 SQL 存储过程,游标
IF EXISTS(SELECT *FROM sysobjects WHERE id=OBJECT_ID('Proc_fetch_all')) --事先删除存储过程DROP PROCEDURE Proc_fetch_allgoCREATE PROCEDURE Proc_fetch_all AS--当 SET NOCOUNT 为 ON 时,不返回计数(表示受 Transact-SQL 语句
2017-03-16 14:36:03
313
原创 二叉搜索树的实现
#includeusing namespace std;//二叉搜索树左儿子的值比当前节点小,右儿子的数值比当前节点大struct node{ int val; node *lchd,*rchd;};//创建树node *insert(node *p,int x){ if(p==NULL) { node* q=new node; q->val=x; q->lch
2016-12-25 17:23:26
342
原创 最小堆的数组实现
#include using namespace std;#define Maxn 1010class heapClass{private: int heap[Maxn],len;public: heapClass():len(0) { } bool isempty(); void push(int x); int pop();};void heapClass::p
2016-12-25 13:58:22
2348
原创 STL源码剖析之重载操作符
#includeusing namespace std;class INT{public: INT(int i):m_i(i){}; friend ostream& operator<<(ostream& os,const INT& i); int& operator*()const//重载解除指针操作符 { return (int&)m_i; } const INT ope
2016-10-22 12:38:04
361
原创 C++11的bind,bind1st,bind2nd,function
#include#include #include #include#include using namespace std;struct LessSort:public binary_function//函数对象{bool operator()(first_argument_type arg1,second_argument_type arg2)const {
2016-08-24 20:10:30
696
原创 分割字符串
#include #include #include using namespace std;std::vector StringSplit(std::string src,std::string sp){ while(src.find(sp)!=std::string::npos) { int index=src.find(sp); src.replace(index,s
2016-08-24 10:32:28
292
原创 accumulate的用法
#include #include #include #include #include #include using namespace std;string::size_type stringLengthSum(string::size_type SumSoFar,const string& s){ return SumSoFar+s.size();}int main()
2016-08-09 09:46:12
849
原创 对包含指针的容器使用remove要特别小心
#include #include #include #include #include #include #include using namespace std;class Widget{private: int weight;public: Widget() { }; Widget(int val); Widget& operator=(int val);
2016-08-08 15:21:38
338
原创 remove与erease配合使用删除元素
#include #include #include #include using namespace std;class is_odd{public: bool operator()(int x) { return x%2; }};int transmogrity(int x){ return x*x;}int main(){ int a[12]={1,2
2016-08-06 16:34:02
914
原创 当效率至关重要时map::operator[]与map.insert之间的选择
#include #include #include #include using namespace std;class Widget{public: Widget() { }; Widget(double weight); Widget& operator=(double weight); friend ostream& operator<<(ostream& os,
2016-08-02 11:32:25
1421
原创 为包含指针的关联容器指定比较类型
#include #include #include #include #include using namespace std;class DereferenceLess{public: template bool operator()(const T* ptr1,const T* ptr2) { return *ptr1<*ptr2; }};class Defe
2016-08-02 09:50:04
303
原创 C++类的友元函数
#include#include#includeusing namespace std;class Rect{private: int no; int width; int height;public: Rect(int n=0,int w=0,int h=0); //定义为友元函数的原因是因为只有友元函数与成员函数才能访问类的私有成员 friend bool opera
2015-10-23 16:25:11
505
转载 apache service monitor下无服务可供启动
打开Apache service monitor,在service status列表下,竟然没有一个服务,为什么?当然是apache 安装时候出问题了,该怎么办?根据经验,应该是Apache服务安装失败了,怎么安装呢?打开cmd窗口,进入Apache的bin目录,大致如下:cd /d D:/Program Files/Apache Software Foundation/Apach
2015-03-18 14:51:28
2014
原创 C语言查找最大值和最小值递归实现
#include#includevoid Max_Min(int a[],int st,int ed,int *Max,int *Min){ if(ed<=st+1) { if(a[st]>=a[ed]) { *Max=a[st]; *Min=a[ed]; } else { *Max=a[ed]; *Min=a[st]; } retu
2014-12-22 13:49:53
3638
原创 年龄计算器php实现
新建index.php文件,实现表单的设计,如下图所示:年龄计算器出生年份:出生月份:出生天数:然后创建一个date.php,用于计算年龄,如图所示:<?phpif(isset($_POST['submit'])&&$_POST['submit']){ if($_POST['year']!=""&&$_POST['month']!=""&
2014-12-13 22:01:51
1666
原创 模拟实现数据库常用操作效果
index.php:用来显示基本操作:常用原子操作执行添加操作执行删除操作执行查找操作执行更新操作check.php:打击原子操作选项,会弹出一个对话框,效果图如下:<?php$action=$_GET["action"];switch($action){ case "delete": echo "alert('现在可以执行删除操作');";
2014-12-13 20:34:16
479
原创 简单的用户登录验证
先创建一个index.php脚本文件,其代码如下:用户登录用户名:密 码:然后创建一个check.php的文件,其代码如下:if(isset($_POST['submit'])&&$_POST['submit']){ if($_POST['uname']=="admin"&&$_POST['keyword']=="admin") echo "登录成功"; e
2014-12-12 16:12:12
731
原创 简单的图书管理系统php实现
数据库的结构:create table book(id int not null auto_increment primary key,bookname varchar(50) not null default '',publisher varchar(50) not null default '',author varchar(50) not null default '',pri
2014-12-11 16:02:35
16597
2
原创 php连接mysql
windows目录下的php.ini文件,去掉extension=php_mysql.dll、extension=php_mysqli.dll和extension_dir前的注释,将extension_dir="./"修改为extension_dir="D:\php5.4.31\ext"(我将php5.4.31解压在D:\目录)保存退出。在phpinfo()中看不到Mysql.
2014-12-10 15:17:40
382
原创 我的第一个html
$str = <<<EOTMy first HTML case/*使用style标记定义p*/ p{ font-size:30px; color:black; text-align:center;/*方法1:设置文档位置为中心*/ } 春晓 春眠不觉晓 处处闻啼鸟 夜来风雨声 花落知多少 EOT;echo $str;
2014-12-02 23:46:24
338
原创 php数组的几种遍历方法
$contact=array( "ID"=>1, "姓名"=>"高某", "公司"=>"A公司", "地址"=>"北京市", "电话"=>"(010)69346308", "Email"=>"gm@apache.com");function arr($con)//函数的写法{foreach($con as $key=>$value) echo "${ke
2014-12-01 22:47:53
550
原创 单链表的简单实现
import java.util.Scanner;class node{ int data; node next; public node(int x) { this.data=x; this.next=null; } public node retnode() { return this; }}class LinkList{ node head; p
2014-11-06 21:56:06
332
原创 二叉树最大宽度和高度(java)
题目描述 Description给出一个二叉树,输出它的最大宽度和高度。输入描述 Input Description第一行一个整数n。下面n行每行有两个数,对于第i行的两个数,代表编号为i的节点所连接的两个左右儿子的编号。如果没有某个儿子为空,则为0。输出描述 Output Description输出共一行,输出二叉树的最大宽度和高度,用一个空格隔开。样
2014-10-21 21:45:05
1682
原创 Binary Tree Traversals(二叉树)
Problem DescriptionA binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binary trees called the left and right subtrees. There are three most impor
2014-10-21 13:51:20
397
原创 Prime Ring Problem
Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.
2014-10-19 17:27:36
347
原创 Let the Balloon Rise
Problem DescriptionContest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest i
2014-10-19 14:43:03
406
原创 Max Sum
Problem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 +
2014-10-18 22:12:51
347
原创 A + B Problem
Problem DescriptionCalculate A + B.InputEach line will contain two integers A and B. Process to end of file.OutputFor each case, output A + B in one line.Sample Input1 1Sample Output
2014-10-18 20:05:50
386
原创 A + B Problem II
Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1<=T<=20) wh
2014-10-18 18:48:59
270
原创 N!
package Factorial;public class Factorial { public static long fac(long n) { if(n==1||n==0) return 1; else return n*fac(n-1); } public static void main(String[] args) { System.out.println(f
2014-10-16 23:22:40
382
原创 java排序
public class BubbleSort{//Java冒泡排序 public void Bubble(Integer data[]) { for(int i=0;i<data.length-1;i++) for(int j=0;j<data.length-1-i;j++) if(data[j]>data[j+1]) { int tmp=data[j]
2014-10-15 23:52:26
309
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人