随笔分类 - C语言练习
摘要:递归函数我总结有三步: 一、函数判断条件; 二、数学规律; 三、初值; 例如 斐波那契数列: 1 1 2 3 5 8 13 21 34 56 …… if (n == 1 || n==2){ return 1; } else { return Fibonacci(n-1) + Fibonacci(n-
阅读全文
摘要:#include<stdio.h>void *Memory_Copy(void *to,const void *from,size_t length)//把b拷贝到a 拷贝sizeof(b)个 { char *from_p=(char *)from; char *to_p=(char *)to; i
阅读全文
摘要:在windows下 #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<string.h> using namespace std; #define length 6 int main() { char* password
阅读全文
摘要://买小鸡程序 #include<stdio.h> #include<math.h> #include<windows.h> using namespace std; void buy() { int cock=0; int hen=0; int child_chicken=0; int numbe
阅读全文
摘要:#include<iostream> #include<iomanip> //setw()函数的头文件 using namespace std; int main() { enum color_set {red,yellow,blue,white,black}; //声明枚举类型color colo
阅读全文
摘要:#include<iostream> #include<iomanip> using namespace std; int main() { int flower; int ten; int hundred; int number; int flag=0; for (int i = 1; i < 1
阅读全文
摘要:#include<iostream> #include<string.h> using namespace std; struct date //结构体可以定义在函数内,但是不能在函数外调用 { int year; int month; int day; }X1,X2,X3; //在没有typede
阅读全文
摘要:include<iostream> using namespace std; int* Array() { int *a; a=new int [10]; for(int i=0;i<10;i++) { a[i]=i+1; cout<<a[i]<<" "; } cout<<endl; return
阅读全文
摘要:#include<iostream> #include<string> using namespace std; class point{ private: int x; int y; public: void setx(int x){ this->x=x; } int getx(){ return
阅读全文

浙公网安备 33010602011771号