memcpy实现 strcpy实现,没有考虑地址重叠 char * strcpy(char *dst,const char *src) //[1]{ assert(dst != NULL && src != NULL); //[2] char *ret = dst; //[3] while ((*d ...
分类:
其他好文 时间:
2016-04-11 22:13:00
阅读次数:
156
一、变量 1.变量的赋值 name=“yoyo”,name就是一个变量,一个可变的量。 变量的命名规则: 变量名只能是字母、数字或下划线的任意组合 变量名的第一个字符不能是数字 以下关键字不能声明为变量名 ['and', 'as', 'assert', 'break', 'class', 'cont ...
分类:
编程语言 时间:
2016-04-11 15:48:36
阅读次数:
213
//头文件queue.h #pragma once #include<assert.h> #include<iostream> using namespace std; typedef int ElemType; #define MAX_SIZE 8 typedef struct Queue { E ...
分类:
其他好文 时间:
2016-04-11 11:57:18
阅读次数:
135
前置代码:structpos
{
pos(introw=0,intcol=0)
:_row(row)
,_col(col)
{}
int_row;
int_col;
};
voidGetMaze(int*arr,intn)
{
FILE*fout=fopen("MazeMap.txt","r");
assert(fout);
for(inti=0;i<n;i++)
{
for(intj=0;j<n;)
{
charch=fgetc(fout);
..
分类:
其他好文 时间:
2016-04-11 07:27:04
阅读次数:
184
#define_CRT_SECURE_NO_WARNINGS1#include<iostream>#include<assert.h>usingnamespacestd;enumNODETYPE{HEAD,VALUE,SUB};structGeneralizedNode{NODETYPE_type;GeneralizedNode*_next;union{char_value;GeneralizedNode*_sublist;};GeneralizedNode(NODETYPEtype=..
分类:
其他好文 时间:
2016-04-10 19:35:25
阅读次数:
174
#include<iostream>#include<vector>#include<assert.h>#include<math.h>usingnamespacestd;template<classT>classLess{public:booloperator()(constT&L,constT&R){returnL<R;}};template<classT>classGreater{public:booloper..
分类:
其他好文 时间:
2016-04-10 19:35:05
阅读次数:
221
代码段1: 代码段2:关于MFC中的#ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #endif 情况1:#ifdef _DEBUGvirtual void AssertValid() const; //assert( ...
分类:
编程语言 时间:
2016-04-08 21:27:00
阅读次数:
280
//1.模拟实现strstr函数。
#include<stdio.h>
#include<assert.h>
char*my_strstr(char*str,char*p)
{
char*cp=p;
char*p1=str;
assert(*p);
if(!*p)
returnNULL;
if(!*p1)
returnNULL;
char*p2=str;
while(*p1)
{
p2=p1;
cp=p;
while(*p2&&*cp&&!..
分类:
其他好文 时间:
2016-04-08 15:26:59
阅读次数:
114
代码如下:
#pragmaonce
#include<iostream>
#include<assert.h>
#include<string>
usingnamespacestd;
#defineUN_INIT0XCCCCCCCCCCCCCCCC;
#defineMAX0x7FFFFFFFFFFFFFFF
#defineMIN0X8000000000000000
typedeflonglongINT64;
classBigData
{
public:
Big..
分类:
编程语言 时间:
2016-04-06 15:32:21
阅读次数:
313
#ifndef_CALENDAR__H_#include<assert.h>#include<iostream>usingnamespacestd;classCDate{ friendboolleapyear(intyear); friendintgetmonthday(intyear,intmonth);public: voidSetDate(intyear,intmonth,intday) { _year=year; _month=month; _day=day; } CDa..
分类:
编程语言 时间:
2016-04-06 00:47:09
阅读次数:
586