函数,结构体,折半查找
来源:互联网 发布:匡恩网络最新动态 编辑:程序博客网 时间:2024/06/02 03:12
//递归函数/*int remul(int num){ if (num<=1) { return 1; } else{ return num*remul(num-1); }}*///这就是一个结构体//这只是一个类型/*struct point{ float x;//x轴 float y;//y轴};*///矩形/*struct rect{ float x; float y; float length; float width;};struct student{ char name[20]; int age; char sex[4]; char number[40];};//给数据类型起名字.typedef int age;typedef float num1;typedef double num2;typedef char name;//简化结构体typedef struct student stu;//简化数组定义typedef char array[10];**//*struct student1{ char name[20]; int fen; int age;};typedef struct student1 sstu;typedef int fenshu;typedef int nianling;*//*struct test{ int a; int b; char c; char d; char e; char f; char r; double k;};*//*struct point { float a; float b; };typedef struct point point;struct kg{ float x; float y;};typedef struct kg kuangao;struct juxing{ point p; kuangao kgao;}; *///学生机构体/*struct student{ char name[20]; int age; // char sex[5]; };typedef struct student std;*//*struct student{ char name [20]; int fenshu;};typedef struct student student;*/
//赋初值 struct point p={10.0,20.0}; //修改值 p.x=30.0; p.y=40.0; printf("x=%f,y=%f",p.x,p.y);
unsigned long i=sizeof(struct test); printf("%ld",i); */ /* //赋初值的语法.如果赋完初值,就不可以再用这种语法 point p={10.0,20.0}; kuangao s={10.0,22.0}; //嵌套结构体的初始化方式,第一种 // struct juxing r={{10.0,20.0},{11.0,23.0}}; //第二种 struct juxing r1={p,s}; r1.p.a=10.0; r1.p.b=12.0; r1.kgao.x=13.0; r1.kgao.y=15.0;
//折半查找 /* int a[10]={1,3,5,7,9,11,13,15,17,19}; int first=0; int last=9; int mid=(first+last)/2; int temp=19; while (first<=last) { if (a[mid]==temp) { printf("找到了,第%d位置",mid); break; } else{ if (temp<a[mid]) { last=mid-1; mid=(first+last)/2; } if (temp>a[mid]) { first=mid+1; mid=(first+last)/2; } } } if (first>last) { printf("sorry,i can't find it"); } */
0 0
- 函数,结构体,折半查找
- .编写折半查找函数。
- erl_线性结构-折半查找
- 折半查找函数模板举例
- OJ函数之折半查找
- C/C++折半查找函数bsearch
- 折半查找的函数实现(C++)
- 用c语言实现折半查找函数
- c语言:编写折半查找函数
- 【C语言】编写一个折半查找函数
- C语言:编写折半查找函数
- 【笔记】用函数实现折半查找
- 利用函数bin_search实现折半查找
- 使用函数,实现编写折半查找
- 用函数实现折半查找,方便调用
- 折半查找
- 折半查找
- 折半查找
- FTP服务器配置(cmd中ftp命令)
- 二哥学算法之单向链表
- 自学安卓的一些烦恼
- 2014ACM/ICPC亚洲区北京站现场赛(HDU 5111,5115,5119,5120,5122)
- 第13周项目5(1)统计字母‘A’的出现次数
- 函数,结构体,折半查找
- UVA 10066 10192
- 组合数学中那些有趣的球和盒子的问题(超强闷骚版,再也不怕球球了)
- GitHub详细教程
- EventBus初次使用
- Android 中关于SharedPreferences 操作模式的设置
- Ubuntu-校园网-神州数码客户端-ZDClient-连上后频繁掉线问题
- C++ Primer学习笔记2-变量与基本类型
- UVA - 1591 Data Mining