- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 单链表
//-----------------------单链表操作--------------------------- #include #include typedef struct LearList { int num; struct LearList* pNext; }LearList; LearList* pHead = NULL; LearLis
2012-12-24 20:18:10 301 1
转载 兔子生兔子问题
#include using namespace std; #define MONTH 5 int Feibo(int month) { int total = 1; if(month>=3) total = Feibo(month-1)+Feibo(month-2); return total; } void main() { int total = 0
2012-09-22 21:32:50 692
原创 冒泡排序
以从小到大排序为例: 设数组长度为N。 1.比较相邻的前后二个数据,如果前面数据大于后面的数据,就将二个数据交换。 2.这样对数组的第0个数据到N-1个数据进行一次遍历后,最大的一个数据就“沉”到数组第N-1个位置。 3.N=N-1,如果N不为0就重复前面二步,否则排序完成。#include using namespace std; void BubbleSort(in
2012-09-14 00:37:05 230
原创 预处理
判断 如果定义了 如果没定义 #if #ifdef #ifndef #endif #endif #endif #include int main() { int a = 1; //int a(不赋
2012-05-23 01:55:19 282
原创 strlen and sizeof
Given: #include int main() { char s1[] = { 'M', 'y', 'W', 'o', 'r', 'd' }; char s2[] = "MyWord"; printf("%d %d\n",strlen(s1),strlen(s2));//random num 6 printf("%d %d\n",sizeof(s1),
2012-05-21 13:36:26 217
原创 result of += in C and C++
QUESTION: #include int main() { int i = 0; (i+=10)+=10; printf("i = %d\n", i); return 0; } In.c :error: lvalue required as left operand of assignment In .cpp :i = 20 ANSWER 1:
2012-05-21 13:30:54 411
C++入门(C++入门教程)
2010-10-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人