经过四次的修改和优化,终于将推箱子这个游戏完整的写出来了,今天就像大家分享一下这个游戏的编写。

  这个游戏界面的编写总的来说不困难,主要是推动箱子的算法。

  (1)利用数组和windows api 即可写出界面

    

  1. #define N 15
  2. #define M 15
  3. int map[N][M] = {
  4. { , , , , , , , , , , , , , , },
  5. { , , , , , , , , , , , , , , },
  6. { , , , , , , , , , , , , , , },
  7. { , , , , , , , , , , , , , , },//0->空白
  8. { , , , , , , , , , , , , , , },//1->墙
  9. { , , , , , , , , , , , , , , },//2->人
  10. { , , , , , , , , , , , , , , },//3->箱子
  11. { , , , , , , , , , , , , , , },//4->位置
  12. { , , , , , , , , , , , , , , },
  13. { , , , , , , , , , , , , , , },
  14. { , , , , , , , , , , , , , , },
  15. { , , , , , , , , , , , , , , },
  16. { , , , , , , , , , , , , , , },
  17. { , , , , , , , , , , , , , , },
  18. { , , , , , , , , , , , , , , },
  19.  
  20. void PushBox::Color(int m)//封装到PushBox类里
  21. {
  22. HANDLE consolehwnd;//创建句柄,详细句柄知识,请百度一下或查MSDN
  23. consolehwnd = GetStdHandle(STD_OUTPUT_HANDLE);//实例化句柄
  24. SetConsoleTextAttribute(consolehwnd, m);
  25. }
  26.  
  27. void PushBox::Drop(int map[N][M])
  28. {
  29. int i, j;
  30. for (i = ; i < N; i++)
  31. {
  32. for (j = ; j < M; j++)
  33. switch (map[i][j])
  34. {
  35. case : Color(); std::cout << " "; break;
  36. case : Color(); std::cout << "■"; break;
  37. case : Color(); std::cout << "△"; break;
  38. case : Color(); std::cout << "□"; break;
  39. case : Color(); std::cout << "☆"; break;
  40. case : Color(); std::cout << "◆"; break;//箱子到达目标位置
  41. case : Color(); std::cout << "△"; break;//表示人与位置重叠
  42.  
  43. }
  44. std::cout << "\n";
  45. }
  46. }

  

  (2)推箱子算法:本人比较笨,没有找到捷径,所以就穷举了推箱子步骤,分析如下:

      以人为中心,出现两种可能:①人在空位 ②人在目标位置上

       ①有六种可能:(注:x1,y1, x2, y2为坐标的偏移量,i ,为人所在的坐标 )

       

      

    ②人在目标位置上 同样也有六种可能:

        

    用if语句进行对这12中可能进行判断,除了处理这几种能够移动的外,其他没有可能移动,分析清楚,则很容写出移动算法:

        

        

  1. int PushBox::push(int map[N][M],int x1,int x2,int y1,int y2)
  2. {
  3. int i, j;
  4. Postion(map, &i, &j);
  5. /*******************人在空格处*/
  6. if (map[i][j] == )
  7. {
  8. //人前是箱子,箱子在空格处
  9. if (map[i + x1][j + y1] == )
  10. { //箱子前面为空格S
  11. if (map[i + x2][j + y2] == )
  12. {
  13. map[i][j] = ;
  14. map[i + x1][j + y1] = ;
  15. map[i + x2][j + y2] = ;
  16. return ;
  17. }
  18. //箱子前面为位置
  19. if (map[i + x2][j + y2] == )
  20. {
  21. map[i][j] = ;
  22. map[i + x1][j + y1] = ;
  23. map[i + x2][j + y2] = ;
  24. return ;
  25. }
  26. }
  27. //人前为箱子,箱子在位置上
  28. if (map[i + x1][j + y1] == )
  29. {
  30. //箱子前面为空
  31. if (map[i + x2][j + y2] == )
  32. {
  33. map[i + x2][j + y2] = ;
  34. map[i + x1][j + y1] = ;
  35. map[i][j] = ;
  36. return ;
  37.  
  38. }
  39. //箱子前面为位置
  40. if (map[i + x2][j + y2] == )
  41. {
  42. map[i][j] = ;
  43. map[i + x1][j + y1] = ;
  44. map[i + x2][j + y2] = ;
  45. return ;
  46. }
  47.  
  48. }
  49. /*--------------------*/
  50. //人前为空格
  51. if (map[i + x1][j + y1] == )
  52. {
  53. map[i + x1][j + y1] = ;
  54. map[i][j] = ;
  55. return ;
  56. }
  57. //人前为位置
  58. if (map[i + x1][j + y1] == )
  59. {
  60. map[i + x1][j + y1] = ;
  61. map[i][j] = ;
  62. return ;
  63. }
  64. return ;
  65. }
  66. /*******************人在位置上*/
  67. if (map[i][j] == )
  68. {
  69. //位置前面是箱子,箱子在空格
  70. if (map[i + x1][j + y1] == )
  71. {
  72. //箱子前面为空格
  73. if (map[i + x2][j + y2] == )
  74. {
  75. map[i][j] = ;
  76. map[i + x1][j + y1] = ;
  77. map[i + x2][j + y2] = ;
  78. return ;
  79. }
  80. //箱子前面为位置
  81. if (map[i + x2][j + y2] == )
  82. {
  83. map[i][j] = ;
  84. map[i + x1][j + y1] = ;
  85. map[i + x2][j + y2] = ;
  86. return ;
  87. }
  88. }
  89. //位置前面是箱子,箱子在位置
  90. if (map[i + x1][j + y1] == )
  91. {
  92. //箱子前面是空格
  93. if (map[i + x2][j + y2] == )
  94. {
  95. map[i][j] = ;
  96. map[i + x1][j + y1] = ;
  97. map[i + x2][j + y2] = ;
  98. return ;
  99. }
  100. //箱子前面是位置
  101. if (map[i + x2][j + y2] == )
  102. {
  103. map[i][j] = ;
  104. map[i + x1][j + y1] = ;
  105. map[i + x2][j + y2] = ;
  106. return ;
  107. }
  108. }
  109.  
  110. /*-----------------*/
  111. //人前为位置
  112. if (map[i + x1][j + y1] == )
  113. {
  114. map[i + x1][j + y1] = ;
  115. map[i][j] = ;
  116. return ;
  117. }
  118. //人前为空格
  119. if (map[i + x1][j + y1] == )
  120. {
  121. map[i + x1][j + y1] = ;
  122. map[i][j] = ;
  123. return ;
  124. }
  125. return ;
  126. }return ;
  127. }

        

    这里写返回1值既可以减少系统的判断,还可以判断是否执行了移动操作,方便统计移动的步数

    (3)编写获取人的位置函数、判断是否获胜

      获取人的位置,只需要判断得到地图中6或者2其中一个坐标,由于需要横坐标和纵坐标,所以利用指针得到位置

      

  1. void PushBox::Postion(int map[N][M], int *cl, int *cow)
  2. {
  3. int i, j;
  4. for (i = ; i < N; i++)
  5. {
  6. for (j = ; j < M; j++)
  7. {
  8. if (map[i][j] == || map[i][j] == )goto ML;
  9. }
  10. }ML:
  11. *cl = i;
  12. *cow = j;
  13. }

    判断是否获胜:即地图中没有目标位置,就获胜,若胜利返回1值,否则返回0;

  1. int PushBox::juide(int map[N][M])
  2. {
  3. int i, j;
  4. for (i = ; i < N; i++)
  5. {
  6. for (j = ; j < M; j++)
  7. {
  8. if (map[i][j] == )return ;
  9. if (map[i][j] == )return ;
  10. }
  11.  
  12. if (i == N - && j == M - )return ;
  13. }
  14. }

   (4)编写移动方向算法,并统计执行步数

    

  1. int PushBox::move(int map[N][M], char ch)
  2. {
  3.  
  4. static int step = ;
  5. int x1, x2, y1, y2;
  6. switch (ch)
  7. {
  8. case 's':
  9. case 'S': x1 = ; x2 = ; y1 = ; y2 = ;
  10. if (push(map, x1, x2, y1, y2)) step++; return step;
  11.  
  12. case 'w':
  13. case 'W': x1 = -; x2 = -; y1 = ; y2 = ;
  14. if (push(map,x1,x2,y1,y2)) step++; return step;
  15.  
  16. case 'A':
  17. case 'a': x1 = ; x2 = ; y1 = -; y2 = -;
  18. if (push(map,x1,x2,y1,y2)) step++; return step;
  19. case 'D':
  20. case 'd': x1 = ; x2 = ; y1 = ; y2 = ;
  21. if (push(map,x1,x2,y1,y2)) step++; return step;
  22. }
  23. }

  (5)Push类的封装,将以上的几个方法封装到类里,建立头文件

  1. #include <iostream>
  2. using namespace std;
  3. #include <windows.h>
  4. #include <string.h>
  5. #include <conio.h>
  6. #include <fstream>
  7. #pragma warning(disable:4996)
  8. #define N 15
  9. #define M 15
  10.  
  11. //建立一个推箱子相关操作的类
  12. /*--------------------------PushBox类编写--------------------------------------*/
  13. /****************************************************************************/
  14. class PushBox{
  15. public:
  16. int move(int map[N][M], char ch);//移动箱子
  17. void Drop(int map[N][M]);//箱子界面编写
  18. int juide(int map[N][M]);//判断是否全部移入位置,成功返回1,失败返回0
  19. private:
  20. int push(int map[N][M],int x1,int x2,int y1,int y2);
  21. void Color(int m);
  22. void Postion(int map[N][M], int *i, int *j);
  23. };

  (6)主函数的编写:这里我将地图放入外部txt文件中,方便以后添加地图

  

  1. #include <iostream>
  2. using namespace std;
  3. #include <windows.h>
  4. #include <string.h>
  5. #include <conio.h>
  6. #include "Push.h"
  7. #pragma warning(disable:4996)
  8. #define N 15
  9. #define M 15
  10.  
  11. int read_map(int *p);
  12. void change_map(int *p, char *temp);
  13. //主函数
  14.  
  15. int main()
  16. {
  17. int map[N][M] = { };
  18. PushBox box;
  19. int *p = &map[][];
  20. int select = read_map(p);
  21. int step = ;
  22. while ()
  23. {
  24. cout << "你选择的关卡是:" << select << endl;
  25. cout << "你走了:" << step << "步";
  26. box.Drop(map);
  27. cout << "W-----向上 S------向下" << endl;
  28. cout << "A-----向左 S------向右" << endl;
  29. char ch;
  30. ch = _getch();
  31. step = box.move(map, ch);
  32. system("cls");
  33. if (box.juide(map))break;
  34. }
  35. std::cout << "你赢了!";
  36. std::cout << "共走:" << step << "步";
  37. getchar();
  38. getchar();
  39. }
  40.  
  41. /*选择关卡*/
  42. int read_map(int *p)
  43. {
  44. int ch;
  45. cout << "请输入关卡:";
  46. cin >> ch;
  47. char temp[];
  48. switch (ch)
  49. {
  50. case :strcpy(temp, "map/map_1.txt"); change_map(p, temp); system("cls"); return ;
  51. case :strcpy(temp, "map/map_2.txt"); change_map(p, temp); system("cls"); return ;
  52. }
  53.  
  54. }
  55. /*打开关卡*/
  56. void change_map(int *p, char *temp)
  57. {
  58. ifstream infile;
  59. infile.open(temp);
  60. while (!infile.eof())
  61. {
  62. infile >> *p;
  63. p++;
  64. }
  65. infile.close();
  66. }

  程序分析图:

      

  经过调试运行,暂时还没有发现BUG,一下是源代码,希望大家发现了以后给我留言,写得不好的地方希望大家能够指出

   源文件

  1. /**************************************************
  2. * Name : 推箱子
  3. * FileName : PushBox.cpp
  4. * Author : 和导
  5. * Version : V4.0
  6. * Date :
  7. *Description : 制作一个简单的推箱子
  8.  
  9. *Function List : (1)void read_map(int *p);
  10. (2)void change_map(int *p, char *temp);
  11. --------------
  12. History:
  13. <author> <time> <reviseInf>
  14. 和导 2016/4/1 把类封装到头文件中,重写推函数,添加地图
  15. ****************************************************/
  16.  
  17. #include <iostream>
  18. using namespace std;
  19. #include <windows.h>
  20. #include <string.h>
  21. #include <conio.h>
  22. #include "Push.h"
  23. #pragma warning(disable:4996)
  24. #define N 15
  25. #define M 15
  26.  
  27. int read_map(int *p);
  28. void change_map(int *p, char *temp);
  29. //主函数
  30.  
  31. int main()
  32. {
  33. int map[N][M] = { };
  34. PushBox box;
  35. int *p = &map[][];
  36. int select = read_map(p);
  37. int step = ;
  38. while ()
  39. {
  40. cout << "你选择的关卡是:" << select << endl;
  41. cout << "你走了:" << step << "步";
  42. box.Drop(map);
  43. cout << "W-----向上 S------向下" << endl;
  44. cout << "A-----向左 S------向右" << endl;
  45. char ch;
  46. ch = _getch();
  47. step = box.move(map, ch);
  48. system("cls");
  49. if (box.juide(map))break;
  50. }
  51. std::cout << "你赢了!";
  52. std::cout << "共走:" << step << "步";
  53. getchar();
  54. getchar();
  55. }
  56.  
  57. /*选择关卡*/
  58. int read_map(int *p)
  59. {
  60. int ch;
  61. cout << "请输入关卡:";
  62. cin >> ch;
  63. char temp[];
  64. switch (ch)
  65. {
  66. case :strcpy(temp, "map/map_1.txt"); change_map(p, temp); system("cls"); return ;
  67. case :strcpy(temp, "map/map_2.txt"); change_map(p, temp); system("cls"); return ;
  68. }
  69.  
  70. }
  71. /*打开关卡*/
  72. void change_map(int *p, char *temp)
  73. {
  74. ifstream infile;
  75. infile.open(temp);
  76. while (!infile.eof())
  77. {
  78. infile >> *p;
  79. p++;
  80. }
  81. infile.close();
  82. }

 头文件   

  1. #include <iostream>
  2. using namespace std;
  3. #include <windows.h>
  4. #include <string.h>
  5. #include <conio.h>
  6. #include <fstream>
  7. #pragma warning(disable:4996)
  8. #define N 15
  9. #define M 15
  10.  
  11. //建立一个推箱子相关操作的类
  12. /*--------------------------PushBox类编写--------------------------------------*/
  13. /****************************************************************************/
  14. class PushBox{
  15. public:
  16. int move(int map[N][M], char ch);//移动箱子
  17. void Drop(int map[N][M]);//箱子界面编写
  18. int juide(int map[N][M]);//判断是否全部移入位置,成功返回1,失败返回0
  19. private:
  20. int push(int map[N][M],int x1,int x2,int y1,int y2);
  21. void Color(int m);
  22. void Postion(int map[N][M], int *i, int *j);
  23. };
  24.  
  25. int PushBox::move(int map[N][M], char ch)
  26. {
  27.  
  28. static int step = ;
  29. int x1, x2, y1, y2;
  30. switch (ch)
  31. {
  32. case 's':
  33. case 'S': x1 = ; x2 = ; y1 = ; y2 = ;
  34. if (push(map, x1, x2, y1, y2)) step++; return step;
  35.  
  36. case 'w':
  37. case 'W': x1 = -; x2 = -; y1 = ; y2 = ;
  38. if (push(map,x1,x2,y1,y2)) step++; return step;
  39.  
  40. case 'A':
  41. case 'a': x1 = ; x2 = ; y1 = -; y2 = -;
  42. if (push(map,x1,x2,y1,y2)) step++; return step;
  43. case 'D':
  44. case 'd': x1 = ; x2 = ; y1 = ; y2 = ;
  45. if (push(map,x1,x2,y1,y2)) step++; return step;
  46. }
  47. }
  48.  
  49. void PushBox::Drop(int map[N][M])
  50. {
  51. int i, j;
  52. for (i = ; i < N; i++)
  53. {
  54. for (j = ; j < M; j++)
  55. switch (map[i][j])
  56. {
  57. case : Color(); std::cout << " "; break;
  58. case : Color(); std::cout << "■"; break;
  59. case : Color(); std::cout << "△"; break;
  60. case : Color(); std::cout << "□"; break;
  61. case : Color(); std::cout << "☆"; break;
  62. case : Color(); std::cout << "◆"; break;
  63. case : Color(); std::cout << "△"; break;
  64.  
  65. }
  66. std::cout << "\n";
  67. }
  68. }
  69.  
  70. int PushBox::juide(int map[N][M])
  71. {
  72. int i, j;
  73. for (i = ; i < N; i++)
  74. {
  75. for (j = ; j < M; j++)
  76. {
  77. if (map[i][j] == )return ;
  78. if (map[i][j] == )return ;
  79. }
  80.  
  81. if (i == N - && j == M - )return ;
  82. }
  83. }
  84.  
  85. int PushBox::push(int map[N][M],int x1,int x2,int y1,int y2)
  86. {
  87. int i, j;
  88. Postion(map, &i, &j);
  89. /*******************人在空格处*/
  90. if (map[i][j] == )
  91. {
  92. //人前是箱子,箱子在空格处
  93. if (map[i + x1][j + y1] == )
  94. { //箱子前面为空格S
  95. if (map[i + x2][j + y2] == )
  96. {
  97. map[i][j] = ;
  98. map[i + x1][j + y1] = ;
  99. map[i + x2][j + y2] = ;
  100. return ;
  101. }
  102. //箱子前面为位置
  103. if (map[i + x2][j + y2] == )
  104. {
  105. map[i][j] = ;
  106. map[i + x1][j + y1] = ;
  107. map[i + x2][j + y2] = ;
  108. return ;
  109. }
  110. }
  111. //人前为箱子,箱子在位置上
  112. if (map[i + x1][j + y1] == )
  113. {
  114. //箱子前面为空
  115. if (map[i + x2][j + y2] == )
  116. {
  117. map[i + x2][j + y2] = ;
  118. map[i + x1][j + y1] = ;
  119. map[i][j] = ;
  120. return ;
  121.  
  122. }
  123. //箱子前面为位置
  124. if (map[i + x2][j + y2] == )
  125. {
  126. map[i][j] = ;
  127. map[i + x1][j + y1] = ;
  128. map[i + x2][j + y2] = ;
  129. return ;
  130. }
  131.  
  132. }
  133. /*--------------------*/
  134. //人前为空格
  135. if (map[i + x1][j + y1] == )
  136. {
  137. map[i + x1][j + y1] = ;
  138. map[i][j] = ;
  139. return ;
  140. }
  141. //人前为位置
  142. if (map[i + x1][j + y1] == )
  143. {
  144. map[i + x1][j + y1] = ;
  145. map[i][j] = ;
  146. return ;
  147. }
  148. return ;
  149. }
  150. /*******************人在位置上*/
  151. if (map[i][j] == )
  152. {
  153. //位置前面是箱子,箱子在空格
  154. if (map[i + x1][j + y1] == )
  155. {
  156. //箱子前面为空格
  157. if (map[i + x2][j + y2] == )
  158. {
  159. map[i][j] = ;
  160. map[i + x1][j + y1] = ;
  161. map[i + x2][j + y2] = ;
  162. return ;
  163. }
  164. //箱子前面为位置
  165. if (map[i + x2][j + y2] == )
  166. {
  167. map[i][j] = ;
  168. map[i + x1][j + y1] = ;
  169. map[i + x2][j + y2] = ;
  170. return ;
  171. }
  172. }
  173. //位置前面是箱子,箱子在位置
  174. if (map[i + x1][j + y1] == )
  175. {
  176. //箱子前面是空格
  177. if (map[i + x2][j + y2] == )
  178. {
  179. map[i][j] = ;
  180. map[i + x1][j + y1] = ;
  181. map[i + x2][j + y2] = ;
  182. return ;
  183. }
  184. //箱子前面是位置
  185. if (map[i + x2][j + y2] == )
  186. {
  187. map[i][j] = ;
  188. map[i + x1][j + y1] = ;
  189. map[i + x2][j + y2] = ;
  190. return ;
  191. }
  192. }
  193.  
  194. /*-----------------*/
  195. //人前为位置
  196. if (map[i + x1][j + y1] == )
  197. {
  198. map[i + x1][j + y1] = ;
  199. map[i][j] = ;
  200. return ;
  201. }
  202. //人前为空格
  203. if (map[i + x1][j + y1] == )
  204. {
  205. map[i + x1][j + y1] = ;
  206. map[i][j] = ;
  207. return ;
  208. }
  209. return ;
  210. }return ;
  211. }
  212.  
  213. void PushBox::Postion(int map[N][M], int *cl, int *cow)
  214. {
  215. int i, j;
  216. for (i = ; i < N; i++)
  217. {
  218. for (j = ; j < M; j++)
  219. {
  220. if (map[i][j] == || map[i][j] == )goto ML;
  221. }
  222. }ML:
  223. *cl = i;
  224. *cow = j;
  225. ;
  226. }
  227.  
  228. void PushBox::Color(int m)
  229. {
  230. HANDLE consolehwnd;//创建句柄,详细句柄知识,请百度一下或查MSDN
  231. consolehwnd = GetStdHandle(STD_OUTPUT_HANDLE);//实例化句柄
  232. SetConsoleTextAttribute(consolehwnd, m);
  233. }

两个地图张

  1.  
  1.  

 文件放置如图:

c++、c实现推箱子小游戏的更多相关文章

  1. 完整版本的推箱子小游戏,最简单的纯C语言打造

    /* 推箱子小游戏 1.定义绘制样式 用二维数组的方式 2.绘制图像 3.找出当前位置 4.逻辑判断,制造动作 根据数学xy轴的规律,这里使用ij 上移,行轴上升,行数减少 下移,行数下降,函数增加 ...

  2. C++ 控制台推箱子小游戏

              // 游戏菜单.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<iostream> #in ...

  3. 推箱子小游戏《格鲁的实验室》13关 - bfs最短路径

    下载了一款推箱子小游戏,第13关的时候怎么也破不了最佳纪录(最少步数是9而我们最好的方案是10步),因为数据比较小(6*8的方阵),所以写了个BFS来找最短路. 游戏的目标是把小黄人推到黄色球,小绿人 ...

  4. C/C++编程笔记:C语言写推箱子小游戏,大一学习C语言练手项目

    C语言,作为大多数人的第一门编程语言,重要性不言而喻,很多编程习惯,逻辑方式在此时就已经形成了.这个是我在大一学习 C语言 后写的推箱子小游戏,自己的逻辑能力得到了提升,在这里同大家分享这个推箱子小游 ...

  5. 每个人都可以用C语言写的推箱子小游戏!今天你就可以写出属于自己项目~

    C语言,作为大多数人的第一门编程语言,重要性不言而喻,很多编程习惯,逻辑方式在此时就已经形成了.这个是我在大一学习 C语言 后写的推箱子小游戏,自己的逻辑能力得到了提升,在这里同大家分享这个推箱子小游 ...

  6. 用C#制作推箱子小游戏

    思路分析: 一.制作一个地图 二.地图中放置墙.箱子.人.目标等 三.让小人动起来完成推箱子动作 游戏制作: 1.按照上述地图制作一个地图  (12行×13列) 地图可以看做是行和列组成的,即可以看做 ...

  7. 【面试笔试算法】Program 5 : 推箱子 (网易游戏笔试题)

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 推箱子是一款经典游戏.如图所示,灰色格子代表不能通过区域,蓝色方格是箱子,黑色圆形代表玩家,含有圆点的格子代表目标点. 规 ...

  8. C语言小游戏: 推箱子 支线(一)--1

    好家伙,考完试了 回顾一下2021 回顾一下某次的作业 妙啊 所以, 做一个推箱子小游戏 1.先去4399找一下关卡灵感 就它了 2.在百度上搜几篇推箱子, 参考其中的"■ ☆"图 ...

  9. c语言游戏推箱子

    前两天做了推箱子小游戏,看似简单的一个小游戏背后却 有巨大的秘密,这秘密就是一大堆逻辑. 自从学习了函数过后,的确是解决了很多问题,而且调用很方便,尽管我现在都不是很会调用. 写完一个函数,准备测试一 ...

随机推荐

  1. javascript中对象的每个实例都具有的属性和方法

  2. HTML5几种常见的错误写法

    本文介绍了HTML5常见的6种错误写法,包括:1.不要使用section作为div的替代品 2.只在需要的时候使用header和hgroup 3.不要把所有列表式的链接放在nav里 4.figure元 ...

  3. UVaLive 6858 Frame (水题)

    题意:给定一个矩形框架,给定一个小矩形,问你能不能正好拼起来. 析:很简单么,就三种情况,如果是1*1的矩形,或者是1*2的一定可以,然后就是上面和下面正好能是小矩形的整数倍,左右是少一,两个就是整数 ...

  4. java commons-lang 工具包 逃脱工具 转unicode 及其他

    <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</ar ...

  5. ZendFramework2 与MongoDB的整合

    从网上找了很多文章,先是直接搜关键字找zf2与mongoDB的文章,然后回到源头先学习了一下mongoDB是什么,以及纯PHP环境下怎么用,又从github上找了几个mongoDB的zf2模块,还FQ ...

  6. Spring MVC 的视图转发

    Spring MVC 默认采用的是转发来定位视图,如果要使用重定向,可以如下操作 1.使用RedirectView public ModelAndView login(){ RedirectView ...

  7. Vieta定理

    一元$n$次方程$$P(x)=a_{n}x^{n}+a_{n-1}x^{n-1}+\cdots+a_{a}x+a_{0}=a_{n}(x-x_{1})(x-x_{2})\cdots (x-x_{n}) ...

  8. VS2012开发ActiveX插件 尝试1

    今天闲来无聊研究了下 ActiveX插件开发,以前一直以为很牛逼,然后发现还是比较简单的东西.. 首先: 在开始前 准备好 VS12开发工具,cabarc.exe 工具(注:这是 用来 将文件打包成c ...

  9. Unable to automatically debug "XXXXX“

    I solved this issue by going to C:\Program Files\Microsoft VisualStudio10.0\Common7\IDE then running ...

  10. org.apache.hadoop.fs-ChecksumException

    当ChecksumFileSystem出现问题时抛出 package org.apache.hadoop.fs; import java.io.IOException; /** Thrown for ...