You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
415 B
19 lines
415 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
float price[10] = {28.9, 32.7, 45.6, 78, 35, 86.2, 27.8, 43, 56, 65};
|
|
float total = 0;
|
|
for (int i = 0; i < 10; ++i) {
|
|
int a;
|
|
cin >> a;
|
|
total += price[i] * a;
|
|
}
|
|
//C语言写法
|
|
printf("%.1f\n", total);
|
|
//C++写法
|
|
cout << fixed << setprecision(1) << total << endl;
|
|
return 0;
|
|
}
|