C#交流俱乐部

学习为主,互相帮助

博客园 首页 新随笔 联系 订阅 管理

随笔分类 -  c++

摘要:#include <iostream>#include <string>#include <vector>#include <deque> #include <list>#define MAXSIZE 20 //顺序表的最大长度 using namespace std; int main() { //00001001000001110000000000100001 //00101000000101110000010000100001 int a=2; list<int>::iterator ito... 阅读全文
posted @ 2013-02-18 17:35 bluce chen 阅读(76478) 评论(0) 推荐(0)

摘要:#include <iostream>#include <string> int main() { using namespace std; char t[5]={'a','b','c','f','g'}; for(char *b=t,*q=b+5;b!=q;b++) {//注意cout对char类型的处理 cout << (void*)b << endl; cout << b << endl; cout << *b << 阅读全文
posted @ 2013-01-16 11:04 bluce chen 阅读(589) 评论(0) 推荐(0)

摘要:半吊子水准·几次修改,哎~GetIdx只能用在insert Set,不能用在remove函数内,具体是getidx的实现考虑到插入的时候可自动追加数组末尾等原因SeqList.h代码如下/* * File: SeqList.h * Author: bluce * * Created on 2013年1月6日, 下午5:36 */#ifndef SEQLIST_H#define SEQLIST_H#include <iostream>template<class T>class SeqList {public: SeqList(int Size=64);//构造 阅读全文
posted @ 2013-01-08 18:43 bluce chen 阅读(428) 评论(1) 推荐(1)

摘要:#include <iostream>#include <cstring> //#define BYTE char//传递引用void swapr(int & a,int & b);//传递指针void swapp(int * a,int * b);//按值传递void swapv(int a,int b); int main() { using namespace std; int a=3,b=4; swapr(a,b); cout <<a <<"|" <<b<<endl; swapp 阅读全文
posted @ 2013-01-05 14:51 bluce chen 阅读(505) 评论(0) 推荐(0)

摘要://c++为类型建立别名2种方式://1.使用预处理器#define BYTE char//2.使用c++关键字,通用格式typedef char bd;区别1会在编译时替换掉所有的BYTE 而2不会有此问题,只是为已有的类型建立个新名称//--------------------------------//sizeof使用示例 char tt2[]={'1','2','3'}; cout<<sizeof(tt2)<<endl; //print 3 char tt3[]={"123456789"}; / 阅读全文
posted @ 2012-12-28 17:47 bluce chen 阅读(154) 评论(0) 推荐(0)

摘要://CLOCKS_PER_SEC 每秒钟包含的系统时间单位数cout<<"Enter the delay time,in seconds: "; float secs; cin >>secs; clock_t delay=secs*CLOCKS_PER_SEC; cout<<"starting\a\n"; clock_t start =clock(); while(clock()-start<delay) ; cout<<"done \a\n"; return 0; 阅读全文
posted @ 2012-12-28 16:43 bluce chen 阅读(989) 评论(0) 推荐(0)

摘要:string word; cin >> word; int i,j; for(j=0,i=word.size()-1;j<i;--i,++j) { char temp=word[i]; word[i]=word[j]; word[j]=temp; } cout << word; 阅读全文
posted @ 2012-12-27 18:17 bluce chen 阅读(360) 评论(0) 推荐(0)