C语言计算税费的程序有问题,新手求解
程序代码:
#include <stdio.h> #include <stdlib.h> struct tax { float taxrate; float beforetax; float lowline; }taxx[100]; struct tax taxx[1]={0,0,0}; struct tax taxx[2]={0.05,0,1600}; struct tax taxx[3]={0.1,25,2100}; struct tax taxx[4]={0.15,175,3600}; struct tax taxx[5]={0.2,625,6600}; struct tax taxx[6]={0.25,3625,21600}; struct tax taxx[7]={0.3,8625,41600}; struct tax taxx[8]={0.35,14625,61600}; struct tax taxx[9]={0.4,21625,81600}; struct tax taxx[10]={0.45,29625,101600}; //分别为十档的对应税率与其上一档总税金 float tax(float a,float b,float c) //a为上一档总税金,b此档应缴税部分,c为此档税率 { float y; y=a+b*c; return y; } main() { float x,y,a,b; int i; do { printf("please input income amount(more than zero)\n"); scanf("%f",&x); }while(x<=0); if(x>=1||x<=1600) { i=1; } elseif(x>=1601||x<=2100) { i=2; } elseif(x>=2101||<=3600) { i=3; } elseif(x>=3601||x<=6600) { i=4; } elseif(x>=6601||<=21600) { i=5; } elseif(x>=21601||x<=41600) { i=6; } elseif(x>=41601||x<=61600) { i=7; } elseif(x>=61601||x<=81600) { i=8; } elseif(x>=81601||x<=101600) { i=9; } elseif(x>=101600) { i=10; } a=taxx[i].beforetax; b=taxx[i].taxrate; c=x-taxx[i].lowline; y=tax(a,c,b); printf("your income is %f\nyou should pay %f for tax.\n",x,y); system("pause"); }struct tax taxx[1]={0,0,0}; 有错误,报错:conflicting types for 'taxx'
为什么?