随笔分类 -  c++编程思想

c++class 内存布局
摘要:1 #include 2 using namespace std; 3 class base1 4 { 5 int a; 6 double b; 7 char c; 8 }; 9 int main()10 {11 base1 b;12 return 1;1... 阅读全文

posted @ 2015-05-05 20:48 初日 阅读(1420) 评论(0) 推荐(0)

分苹果
摘要:题目:穷举法:由于3 1 1和1 3 1 是一种分法,所以也就是说在N个篮子里的苹果数目是 n1 2 using namespace std; 3 int count; 4 int foo(int n,int m,int prei,int temp[10]) 5 { 6 int i=0,j=... 阅读全文

posted @ 2014-05-05 23:36 初日 阅读(754) 评论(0) 推荐(0)

c语言算法题目求职用
摘要:1.栈的压入与压出/*输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序。n#include using namespace std;int qin[100005];int qout[100005];int main(void){ int n; int i,j; while(scanf("%d", &n) == 1) { for(i=0; i s; i = 0; j = 0; while(iint seq[10005];bool valid(int x, int y){ if(... 阅读全文

posted @ 2014-03-02 20:27 初日 阅读(351) 评论(0) 推荐(0)

有关#define中的#和##
摘要:在#define中,标准只定义了#和##两种操作。#用来把参数转换成字符串,##则用来连接前后两个参数,把它们变成一个字符串。 1 #include <iostream> 2 #include <fstream> 3 using namespace std; 4 #define D(A) T<< #A << endl; 5 inline void assure(std::ofstream &in, const char* filename="") 6 { 7 if(!in) 8 { 9 fprintf(stderr,& 阅读全文

posted @ 2013-01-19 11:34 初日 阅读(346) 评论(0) 推荐(0)

导航