算菜價:
#include <cstdio> using namespace std; int main() { double num, price; char s[20]; double sum = 0; while(scanf("%s %lf %lf", s, &num, &price) != EOF) { sum += num * price; } printf("%.1lf\n", sum); return 0; }
本文出自 “菜鳥的進階之路” 博客,請務必保留此出處http://beyond316.blog.51cto.com/7367775/1282245