1 #include<stdio.h> 2 #include<string.h> 3 struct good{ 4 char MC; 5 double DJ; 6 int SL; 7 }; 8 int main(){ 9 int N; 10 double All=0.0; 11 scanf("%d",&N); 12 struct good *g = new struct good[N]; 13 for(int i=0;i<N;i++){ 14 scanf("%s %lf %d",&g[i].MC,&g[i].DJ,&g[i].SL); 15 All += g[i].DJ*g[i].SL; 16 } 17 printf("%lf",All); 18 return 0; 19 }
原文:http://www.cnblogs.com/panweiwei/p/6498805.html