-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path222.cpp
More file actions
35 lines (34 loc) · 716 Bytes
/
Copy path222.cpp
File metadata and controls
35 lines (34 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
string str;
bool isFirst = true;
while (getline(cin, str))
{
if (isFirst) {
isFirst = false;
}
else {
cout << endl;
}
istringstream ss(str);
double sum = 0;
double num;
bool isThereInput = false;
while (ss >> num)
{
sum += num;
isThereInput = true;
}
//cout << setprecision(4);
//cout << fixed << ((abs(sum) < 0.00005) ? 0.0000 : sum) << endl;
if (isThereInput) {
printf("%.4f\n", sum);
}
}
return 0;
}