摘要: error c2872,是因为C++里面有set::begin (STL/CLR),即begin()是它里面的一个函数,自己定义的int begin;和int end都是有问题的。系统不知道你是要用标准库里面的函数,还是你定义的变量。所以说是ambulous symbol。另外,用鼠标追踪到错误上,并按F1,如果联网的话,会跳转到在线msdn的帮助,很有用! 阅读全文
posted @ 2013-04-05 20:22 开心成长 阅读(867) 评论(0) 推荐(0) 编辑
摘要: isdigit(int c)//判断是否为数字isalpha(int c)//判断是否为a~z A~Zisalnum(int c)//判断是否是数字或a~z A~Z 阅读全文
posted @ 2013-03-28 16:05 开心成长 阅读(535) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<string>#include<fstream>using namespace std;unsigned int ELFHash(string s){ unsigned int hash=0; unsigned int x=0; int i=0; while(i<s.length()) { hash=(hash<<4)+(s[i++]); if((x=hash&0xF0000000L)!=0) { hash^=(x>>24); ... 阅读全文
posted @ 2013-03-28 14:09 开心成长 阅读(315) 评论(0) 推荐(0) 编辑
摘要: #include<vector>using namespace std;vector<char>Vecprog;int main(){ char ch; cout<<"please input test program:"<<endl; ch=getchar(); int i=0; while(ch!='#') { Vecprog.push_back(ch); ch=getchar(); i++; } for(int j=0;j<Vecprog.size();j++) cout<<Vecpr. 阅读全文
posted @ 2013-03-25 11:36 开心成长 阅读(821) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>using namespace std;char testprog[100];int main(){ char ch; cout<<"please input test program:"<<endl; ch=getchar(); int i=0; while(ch!='#'&&i<100) { testprog[i++]=ch; ch=getchar(); } for(int j=0;j<sizeof(testprog)/sizeof(testprog[0] 阅读全文
posted @ 2013-03-25 11:25 开心成长 阅读(1916) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<string>using namespace std; const int PROFIX=2;char *newstr(char *str,char *seg,const int len){ int i; for(i=0;i<len;++i) str[i]='A'+rand()%26; str[i+1]='\0'; return strcat(str,seg); //该函数调用后seg指向新的字符数组的尾部,str指向字符数组的头部 //例如seg指向'abc'的 阅读全文
posted @ 2013-03-21 16:41 开心成长 阅读(1708) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<ctime>using namespace std;const int LEN_NAME=10;char *rand_str(char *str,const int len){ int i; for(i=0;i<len;++i) str[i]='A'+rand()%26; str[i+1]='\0'; return str;}void main(){ srand((unsigned)time(NULL)); char name[LEN_NAME+1]; cout<<r 阅读全文
posted @ 2013-03-21 14:39 开心成长 阅读(1866) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<string>using namespace std;void main(){ char buffer[1024]; cout<<"请输入原始报文:"<<endl; cin.get(buffer,1024); cout<<buffer<<endl; cout.write(buffer,6);}输入:ni hao ma?则会输出:ni hao ma?ni hao 阅读全文
posted @ 2013-03-21 12:06 开心成长 阅读(418) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<string>using namespace std;void main(){ string seg; cout<<"请输入原始报文:"<<endl; getline(cin,seg); cout<<seg<<endl;}1、上面这段代码只能读入一行,遇到回车就执行cout,比如输入:你好,ok ok!则可输出同样结果。#include<iostream>#include<string>using namespace std; 阅读全文
posted @ 2013-03-21 11:44 开心成长 阅读(353) 评论(0) 推荐(0) 编辑
摘要: char p='z';int c=1;cout<<"please input the word:"<<endl;cin>>p;while(p!='\n'){c=Via.Realize(p,c);p=getchar();//这里不能再用cin>>p,因为cin好像可以自动省略回车字符,之前用cin怎么都不能停止输入,会输入很多行。} 阅读全文
posted @ 2013-03-16 15:39 开心成长 阅读(335) 评论(0) 推荐(0) 编辑