c/c++
didihe1988
这个作者很懒,什么都没留下…
展开
-
sstream(转载)
#include void str( string s );string str();The function str() can be used in two ways. First, it can be used toget a copy of the string that is being manipulated by the current stream string转载 2013-07-29 20:10:23 · 692 阅读 · 0 评论 -
error C2275: “FILE” : 将此类型用作表达式非法
C语言中局部变量的声明必须放在函数的开始,不能随用随声明。所以FILE* pf 放在函数中间编译器报错了。原创 2013-09-30 16:33:31 · 5877 阅读 · 0 评论 -
expected specifier-qualifier-list before sockaddr_in
typedef struct Socket{int sock;struct sockaddr_in addr;}Socket;error:expected specifier-qualifier-list before sockaddr_in漏掉sockaddr_in前的struct。也有可能是一个词汇再未定义之前就使用就会出项这种错误,可以通过typedef进原创 2013-10-02 23:24:40 · 1362 阅读 · 0 评论 -
《c语言编程之道》笔记
//输入数据时忘记添加&符号int main(){ int a,b; scanf("%d%d",&a,&b); printf("%d,%d\n",a,b);}//奇葩的死循环unsigned int i; for(i=10;i>=0;i--){ printf("%d",i);}//忽略了字符串的结束符int main(){ char* or_str="I am a原创 2013-10-27 19:14:03 · 1005 阅读 · 0 评论 -
异常处理
一.exception.h#include using namespace std;class DivideByZeroException:public runtime_error{public: DivideByZeroException() :runtime_error("attmped to divide by zero"){}};exception.cpp原创 2013-11-06 03:15:48 · 1219 阅读 · 0 评论