- /* 顺序程序设计举例 */
- // 温度.cpp : 定义控制台应用程序的入口点。
- //
- #include "stdafx.h"
- int _tmain(int argc, _TCHAR* argv[])
- {
- float f,c; // 定义f和c为单精度浮点型变量
- f=64.0; // 指定f的值
- c=(5.0/9)*(f-32); // 利用公式计算c的值
- printf("f=%f\nc=%f\n",f,c);
- return 0;
- }
- // 利息.cpp : 定义控制台应用程序的入口点。
- //
- #include "stdafx.h"
- int _tmain(int argc, _TCHAR* argv[])
- {
- float p0=1000,r1=0.0036,r2=0.0225,r3=0.0198,p1,p2,p3; //定义变量
- p1=p0*(1+r1);
- p2=p0*(1+r2);
- p3=p0*(1+r3/2)*(1+r3/2);
- printf("p1=%f\np2=%f\np3=%f\n",p1,p2,p3);
- return 0;
- }
转载于:https://blog.51cto.com/290692/1122038