#include<iostream>#include<assert.h>usingnamespacestd;classString{public: String(char*str="") :_str(newchar[strlen(str)+1]) { cout<<"String()"<<endl; strcpy(_str,str); } ~String() { cout<<"~String()"<<endl; if(_str!=..
分类:
编程语言 时间:
2016-03-11 06:38:44
阅读次数:
213
#include<stdio.h>#include<stdlib.h>#include<assert.h>#include<string.h>char*get_str(char*src,char*dst){char*start=src;staticintcount=0;inti=0;while(*start){if(*start==‘/‘&&*(start+1)==‘/‘&&count%2==0){count++;break;}e..
分类:
编程语言 时间:
2016-03-10 01:45:02
阅读次数:
237
1、 http://bbs.csdn.net/topics/370029802 1 #include <iostream> 2 #include <limits> 3 #include <assert.h> 4 #include <vector> 5 #include <algorithm> 6 #
分类:
其他好文 时间:
2016-03-09 10:41:18
阅读次数:
137
local socket = require"socket" local host = "127.0.0.1"local port = "843"local sever = assert(socket.bind(host, port)) --绑定sever:settimeout(nil) --不设置
分类:
其他好文 时间:
2016-03-08 21:30:35
阅读次数:
120
int findMajority(const std::vector<int> &array) { assert(!array.empty ()); int majority = 0; size_t counter = 0; std::for_each(array.cbegin (), array.
分类:
其他好文 时间:
2016-03-08 00:00:52
阅读次数:
542
断言assert: 当这个关键字后边的条件为假时,程序自动崩溃并提示AssertionError的异常,条件为真时跳过 1 >>> assert 3>5 2 Traceback (most recent call last): 3 File "<pyshell#1>", line 1, in <mo
分类:
其他好文 时间:
2016-03-06 14:06:21
阅读次数:
132
#include<iostream>
usingnamespacestd;
#include<assert.h>
typedefintDataType;
structListNode
{
DataType_data;
ListNode*_next;
ListNode*_prev;
ListNode(DataTypex)
{
_data=x;
_next=NULL;
_prev=NULL;
}
};
classList
{
private:
ListNode*_Head;
ListNod..
分类:
其他好文 时间:
2016-03-06 01:26:10
阅读次数:
208
建立源文件List.cpp#include"List.h"
intmain()
{
Test();
system("pause");
return0;
}建立头文件List.h#ifndef__LIST_H__
#define__LIST_H__
#include<stdio.h>
#include<assert.h>
#include<stdlib.h>
typedefintDataType;
typedefstructListNode
{
Da..
分类:
编程语言 时间:
2016-03-05 22:09:26
阅读次数:
211
用过python assert的朋友应该会经常碰到这样的疑惑,如: (a,b) = (1,'1') assert a==b # error: AssertionError 在代码调试的时候,很难直观的看出为什么错了,除非写成这样: assert 1=='1', "fact==expect, [fac
分类:
编程语言 时间:
2016-03-05 16:22:24
阅读次数:
556
单链表和顺序表能够处理的问题都差不多,但是链表的优点在于能够节省空间,空间的利用率更高,程序执行的效率更快,链表的基本操作也是面试官喜欢考察的问题之一,链表是一种基本的数据结构,下面主要是利用c++来实现链表的基本功能。//单向链表
#include<assert.h>
typ..
分类:
编程语言 时间:
2016-03-05 14:54:32
阅读次数:
223