通过引用传递及modf函数的学习。
来源:互联网 发布:fmea风险评估矩阵 编辑:程序博客网 时间:2024/05/18 01:57
#include <stdio.h>int main(int argc,const char *argv[]){ double pi = 3.14; double integerPart; double fractionPart; fractionPart = modf(pi,&integerPart); printf("integerPart = %.0f,fractionPart=%.2f\n",integerPart,fractionPart); return 0;}
使用方法:
double modf(double X,double *intpart);
X为带双精度浮点数,intpart为保存证书部分的指针。
设返回值为ret
则
X=inpart+ret.
将笛卡尔坐标转换为极坐标
#include <stdio.h>#include <math.h>void cartesianToPolar(float x, float y,double *rPtr,double *thetaPtr){*rPtr = sqrt(x*x+y*y*y)float theta;if(x ==0.0){ if(y ==0.0){ theta = 0.0; }else if (y>0){ theta = M_PI_2; }else{ theta = -M_PI_2; }}else{ theta = atan(y/x);}*thetaPtr = theta;}int main(int argc,const char * argv[]){ double pi = 3.14; double intgerPart; double fractionPart; fractionPart = modf(pi,&integerPart); printf("integerPart=%.0f,fractionPart=%.2f\n",integerPart,fractionPart); double x=3.0; double y=4.0; double radius; double angle; cartesianToPolar(x,y,& radius,&angle); printf("(%.2f,%.2f) becomes (%.2f radians, %.2f)\n",x,y,radius,angle); return 0;}
0 0
- 通过引用传递及modf函数的学习。
- modf ()函数
- 函数modf
- modf 函数
- 引用作为函数与指针及值传递的差别
- 函数值传递,指针传递与引用传递的区别 及解释。
- modf 函数 介绍
- python modf() 函数
- 对象的引用及传递
- JavaScript 函数的引用传递
- 函数的值传递和引用传递
- modf的使用
- 通过value传递对象的引用
- modf
- modf
- 通过引用传递数组
- 通过引用传递字符串
- 通过引用传递数组
- 文件上传下载中的安全问题(上传漏洞与目录遍历攻击)
- struct termios
- 致马上要教的应用13级学生
- IOS性能优化
- linux 数据流重定向
- 通过引用传递及modf函数的学习。
- Hadoop 从零开始学习系列-hive从元数据生成表结构、分区等建表语句
- Java解压密码的zip文件
- linux串口通信
- centos6.5下安装nginx
- Parcelable
- 杭电ACM2057--A + B Again
- 详解Oracle的几种分页查询语句
- 如何准备大量指定大小的文件