原题:http://acm.hdu.edu.cn/showproblem.php?pid=2090
输入无数量限制,用while(~scanf)
printf(”.1f")可以自动四舍五入
#include <iostream>
using namespace std;
int main()
{
char a[100];
double num, pri;
int x;
double total;
while(~scanf("%s",&a))
{
cin>>num>>pri;
total+=num*pri;
}
/*
x=((int)(total*100))%10;
total=(int)(total*10);
if(x>=5)
total+=1;
total=(double)(total/10);
*/
printf("%.1f\n",total);
return 0;
}