C语言写代码的时候碰到问题:
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘{’ token|
检查了很长时间什么都没发现,网上看大家出现这个错误有很多原因。希望以后不用再给自己补充。
报错原因:
语法错误,缺少了一些必要的符号。
报错代码:
这里是函数声明忘记了分号。
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
void money(int year,int loan,float rate)
int main()
{
int n,loan;
float rate;
printf("Input loan:");
scanf("%d",&loan);
printf("Input rate:");
scanf("%f",&rate);
for(n=5;n<=30;n++)
money(n,loan,rate);
return 0;
}
void money(int year,int loan,float rate)
{
int loan,month;
month = year*12;
money = loan*rate(1+pow(1+rate,month))/(pow(1+rate,month)-1);
printf("Year:%d Money:%f\n",year,money)
}
来源:CSDN
作者:Mark7758
链接:https://blog.csdn.net/Mark7758/article/details/104780578