摘要:#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...
阅读全文
随笔分类 - c++
摘要:#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 <<
阅读全文
摘要:半吊子水准·几次修改,哎~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);//构造
阅读全文
摘要:#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
阅读全文
摘要://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"}; /
阅读全文
摘要://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;
阅读全文
摘要: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;
阅读全文
浙公网安备 33010602011771号