标签:r++ use main system ret res oid for rate
/*利息计算程序,for使用范例*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(void)
{
	double amount;/*存款总额*/
	double principal=1000.0;/*初始本金*/
	double rate=0.05;/*年利率*/
	int year;/*储蓄年份*/
	printf("\nWelcome.\n"
	      "Calculate the compound interest\n\n");
    for(year=1;year<=10;year++)
    {
    	amount=principal*pow(1.0+rate,year);
    	printf("%4d%21.2f\n",year,amount);
	}/*end for*/
	system("PAUSE");
	return 0;
 } /*end main*/
标签:r++ use main system ret res oid for rate
原文地址:http://www.cnblogs.com/hgr123456/p/6601889.html