struct hypot typedef
来源:互联网 发布:windows outlook 编辑:程序博客网 时间:2024/05/21 20:21
C语言定义结构体:struct 结构体名称{域定义};
但是为了使用方便用:typedef struct {域定义};结构体名称;
示例:
#include<stdio.h>#include<math.h>struct Point{double x,y;};double dist(struct Point a,struct Point b){ return hypot(a.x - b.x,a.y - b.y);}int main(){ Point a,b; a.x = 1,a.y = 1; b.x = 2,b.y = 2; double c = dist(a,b); printf("%lf\n",c); return 0;}
#include<stdio.h>#include<math.h>typedef struct {double x,y;}Point; //多了typedef,可以像int ,double,float用double dist(Point a,Point b) //少了struct{ return hypot(a.x - b.x,a.y - b.y);}int main(){ Point a,b; a.x = 1,a.y = 1; b.x = 2,b.y = 2; double c = dist(a,b); printf("%lf\n",c); //输出1.414214 return 0;}
0 0
- struct hypot typedef
- hypot()
- hypot
- typedef struct
- typedef struct
- typedef struct
- typedef struct
- Struct && typedef
- struct / typedef
- typedef struct
- typedef struct
- typedef struct
- typedef struct
- typedef struct
- typedef 与 typedef struct
- typedef与typedef struct
- struct和typedef struct
- struct和typedef struct
- 11_奇偶数分离
- POJ 1742 dp
- 动态管理内存之new和delete
- Android Binder驱动中的基础数据结构整理
- hdu2098
- struct hypot typedef
- Mac OS X 利用 Automator/Xcode 控制隐藏文件
- const与class
- igrimace V3 VX 3.0 ig 闪退解决方式
- /usr/local/Trolltech/QtEmbedded-4.8.5-arm/include/QtCore/qatomic_armv5.h:131: 错误:no such instruction
- Android防止多次点击
- 【LeetCode】145. Binary Tree Postorder Traversal 解题报告
- C++命名的强制类型转换(static_cast dynamic_cast const_cast reinterpret_cast)
- hdu 3191 How Many Paths Are There(次短路+条数)