- 博客(13)
- 收藏
- 关注
原创 Word Maze(单词迷宫)
#include <iostream>#include <string>#include <stack>using namespace std;int m,n,len;bool **visited;string word ,*MyMap;struct MyPoint{ int row; int col;};bool fun(int cur ,MyPoint p)
2016-07-08 14:36:28
4021
1
原创 国际象棋中用8个皇后摆在不同的格而且互相不牵制有多少种不同的摆法
#include "iostream"//#include <vector>using namespace std;int count = 0;bool IsDuiJiao(int a[],int data,int cur){ for (int i=0; i<cur; i++) { if (abs(cur-i) == abs(data - a[i]))
2016-07-01 18:46:18
2451
原创 指针传递,引用传递
#include "iostream"#include <vector>using namespace std;void swp(int*a, int*b){ int *temp; temp = a; a = b; b = temp;}void swp2(int *a, int *b){ int temp; temp = *a; *
2016-07-01 11:56:26
308
转载 字符串的排列
#include "iostream"using namespace std;void permu(char * pStr, char * pBegin){ if (*pBegin == '\0') { printf("%s\n",pStr); } else { for (char *pCh = pBegin; *pCh !
2016-07-01 11:46:56
257
原创 打印全排列数字
#include "iostream"using namespace std;bool HasIn(int a[],int data,int cur){ for (int i=0; i<cur; i++) { if (data == a[i]) { return true; } } retur
2016-07-01 11:43:57
829
原创 全排列abc: a,b,c,ab,ac,bc,abc
#include "iostream"#include <vector>using namespace std;void zuhe(char *src,int len, int cur, vector<char> &sc){ if (len==sc.size()) { vector<char>::const_iterator vci = sc.begin();
2016-07-01 11:38:12
1761
原创 顺时针打印矩阵
#include<iostream>#include <iomanip>using namespace std;#define nr 10 //定义矩阵的行和列#define nl 7void main(){ int a1[nr][nl]; int num = 0; for (int i=0;i<nr;i++) { for (int j=0
2016-06-29 14:46:48
572
原创 合并两个排序的链表
#include<iostream>using namespace std;struct MyNode{ int data; MyNode *next;};struct MyList{ MyNode *head;};void CreatMyList(MyList *ml,int n){ if (NULL == ml ) { retu
2016-06-28 22:07:23
262
原创 反转链表
#includeiostream>using namespace std;struct MyNode{ int data; MyNode *next;};struct MyList{ MyNode *head;};void CreatMyList(MyList *ml,int n){ if (NULL == ml || n1) {
2016-06-28 10:36:43
221
转载 public,private,protected
#include<iostream>using namespace std;//////////////////////////////////////////////////////////////////////////class A //父类{private: int privatedateA;protected: int protecteddateA;public:
2016-05-30 16:06:33
282
原创 vs调试
VS调试时按Alt+8打开汇编窗口 Alt+7打开堆栈窗口 Alt+6打开内存窗口 Alt+5打开寄存器窗口看每句C对应的汇编、堆栈、内存和寄存器变化
2016-05-26 15:24:30
305
转载 vector的reserve和resize
vector 的reserve增加了vector的capacity,但是它的size没有改变!而resize改变了vector的capacity同时也增加了它的size!原因如下: reserve是容器预留空间,但在空间内不真正创建元素对象,所以在没有添加新的对象之前,不能引用容器内的元素。加入新的元素时,要调用push_back()/insert()函数。
2016-05-26 11:18:58
267
转载 C指针强制类型转换
int main(void){unsigned int a = 0xFFFFFFF7;unsigned char i = (unsigned char)a;char* b = (char*)&a;printf("%08x, %x", i, *b);return 0;}结果 000000F7 FFFFFFF7解析:int 4字节,他在内存中是反着存
2016-05-18 20:16:50
483
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人