大侠们,小弟自学C语言在一个案例上面有个小小的问题想请教,自己没怎么想明白
#define PERIOD 10#define PRINCIPAL 5000.00
main()
{
int year;
float amount, value, inrate;
amount = PRINCIPAL;
inrate = 0.11;
year = 0;
while(year<=PERIOD)
{
printf("%2d %8.2f\n", year, amount);
value = amount+inrate*amount;
year = year+1;
amount = value;
}
}
这个是个loop,关于那个最后一行amount = value,我想直接把这行去掉把float value这个值去掉 value = amount+inrate*amount;直接用amount代替这个 value,最后也能正确的运行,请问我这么做有什么问题么?我想会不会简化程序??