摘要:
阅读全文
posted @
2013-05-13 14:25 qiushao|
编辑 收藏
自从去年9月开始,c++博客便荒废了!时光荏苒,大半年了!
希望重新顶起吧。
一直困难的一个问题,没成想很弱智。
问题如下:I have a complex program which runs fine in Debug mode in Visual Studio 2008.
When I run it in Release mode, it crashes immediately with "Debug assertion failed in Visual Studio 9.0\VC\include\vector Line 70".
Is there any way I can run the program inside Visual Studio 2008 so I can see stack trace?
Any other tips on this issue?
There are no debug assertions in a release build.
Maybe you are accidentally using a DLL or library that is built in debug mode. All linked modules must be release builds, or all debug builds. You can't mix the two types.
汗颜!
posted @
2013-05-13 14:25 qiushao|
编辑 收藏
int _tmain(int argc, _TCHAR* argv[])
{
int a=2,b=3;
printf("%d",printf("%*s%*s",a,"",b,""));
return 0;
}
posted @
2012-09-04 17:12 qiushao 阅读(180) |
评论 (0) |
编辑 收藏
bool symmetry(long a)
{
long i,temp;
temp=0,i=a;
while(i)
{
temp=10*temp+i%10;
i=i/10;
}
return (temp==a);
}
int _tmain(int argc, char* argv[])
{
long i=12345;
cout<<symmetry(i)<<endl;
return 0;
}
posted @
2012-09-01 21:03 qiushao 阅读(191) |
评论 (0) |
编辑 收藏
int _tmain(int argc, char* argv[])
{
string s;
vector<string> svec;
cout<<"please enter words(enter ctrl+z quit):"<<endl;
while(cin>>s)
svec.push_back(s);
vector<string>::iterator it=svec.begin();
int cnt(0);
while(it!=svec.end())
{
for(int i=0;i!=(*it).length();i++)
{
(*it)[i]=toupper((*it)[i]);
}
cout<<*it<<" ";
cnt++;
if(cnt%4==0)
cout<<endl;
it++;
}
return 0;
}
posted @
2012-07-08 16:15 qiushao 阅读(138) |
评论 (0) |
编辑 收藏
windows.h里包括windef.h winbase.h windgdi.h winuser.h
windows API太多、太复杂,很多文件很大的关联性,如果要使用到windows相关头文件,还是包含windows.h吧
不知为什么仅仅#include <windef.h>
编译有错
windef.h里有定义DWORD BYTE 等等
posted @
2012-06-07 10:46 qiushao 阅读(213) |
评论 (0) |
编辑 收藏
定义一个var-Global.c 定义全局变量 然后在var-Global.h 声明全局变量
哪个文件用到了这些全局变量就在aa.h 文件里#include"var-Global.h" 然后在这个头文件里声明必要的接口函数
extern void fun();
在aa.c文件里只要 #include"aa.h"
参考http://www.2cto.com/kf/201109/104897.html
posted @
2012-06-07 09:37 qiushao 阅读(331) |
评论 (0) |
编辑 收藏
1,准备一份英文简历
2,c++概念牢靠
a,虚函数
b、、、
posted @
2012-06-06 14:30 qiushao 阅读(142) |
评论 (0) |
编辑 收藏
相对于放在栈里的优点:可以在运行时确定数组长度
int* createArr()
{
cout<<"shuru size:"<<endl;
size_t size;
cin>>size;
int* arr=new int[size];
cout<<sizeof(arr)<<endl;
return arr;
}
int _tmain(int argc, _TCHAR* argv[])
{
//int *p;
//p=createArr();
createArr();
return 0;
}
posted @
2012-06-01 14:53 qiushao 阅读(158) |
评论 (0) |
编辑 收藏
哈希表实现:
char find(char *p)
{
if(p==NULL)
{
cout<<"error"<<endl;
return -1;
}
const int size=256;
int hashTable[size]={0};
char *key=p;
while(*(key)!='\0')
{
hashTable[*key++]++;
}
key=p;
while(*key!='\0')
{
if(hashTable[*key]==1)
return *key;
key++;
}
cout<<"All char are repeat!"<<endl;
return -1;
}
int _tmain(int argc, _TCHAR* argv[])
{
char s[]="abdaccdbeef";
cout<<find(s)<<endl;
return 0;
}
char findone(string &s)
{
int len=s.size();
int i;
for(i=0;i<len;i++)
{
int beg=s.find(s[i]);
int end=s.find_last_of(s[i]);
if(beg==i&&end==i)
{
break;
}
}
if(i==len)
{
cout<<"Not found!"<<endl;
return -1;
}
else
return s[i];
}
int _tmain(int argc, _TCHAR* argv[])
{
string s("abdaccbeff");
cout<<findone(s)<<endl;
return 0;
}
posted @
2012-05-22 19:42 qiushao 阅读(231) |
评论 (0) |
编辑 收藏