0
已解决
杨子逸
新手天翼
新手天翼
#include<iostream> using namespace std; int main() { double a,s,d; int se,de; char f; cin>>a>>f; if(a<=1000) { s=12; d=8; } else { se=s-1000; se=se/500; if(se%500>0) { se=se/500+1; se=se*3; s=se+12; } else { se=se*3; s=se+12; } de=a-1000; de=de/500; if(de%500>0) { de=de/500+1; de=de*3; d=de+8; } else { de=de*3; d=de+8; } } if(f=='y') { d=d+4; } if(s>d) cout<<"YD"; else if(d>s) cout<<"SF"; else if(s==d) cout<<"Same"; return 0; }
//80分
0
已采纳
张舒斌
中级光能
中级光能
struct pjf
{
double yw,sx,yu,wl,hx,sw;
int h;
}a[101];
这是结构体的定义;
主要代码:
for(i=1;i<=n;i++)
{
yw1+=a[i].yw;
sx1+=a[i].sx;
yu1+=a[i].yu;
wl1+=a[i].wl;
hx1+=a[i].hx;
sw1+=a[i].sw;
}
以及输出:
for(i=1;i<=n;i++)
{
cout<<a[i].h<<" "<<a[i].yw<<" "<<a[i].sx<<" "<<a[i].yu<<" "<<a[i].wl<<" "<<a[i].hx<<" "<<a[i].sw<<endl;
}
printf("%.1f",yw1/n);
cout<<" ";
printf("%.1f",sx1/n);
cout<<" ";
printf("%.1f",yu1/n);
cout<<" ";
printf("%.1f",wl1/n);
cout<<" ";
printf("%.1f",hx1/n);
cout<<" ";
printf("%.1f",sw1/n);
0
0
0
0
0
0
0