## 错两次气死了(还是没理解透彻造成的~~)
#include <stdio.h>
int main(void) {
double x1, y1, x2, y2, result_x, result_y;
scanf("%lf %lf", &x1, &y1);
scanf("%lf %lf", &x2, &y2);
result_x = x1 + x2;
result_y = y1 + y2;
if ((result_x > -0.05) && (result_x < 0.0)) {
result_x = 0.0;
}
if ((result_y > -0.05) && (result_y < 0.0)) {
result_y = 0.0;
}
printf("(%.1f, %.1f)\n", result_x, result_y);
return 0;
}
由此可见为四舍五入必须特判
#include<string>
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
double n;
scanf("%lf",&n);
printf("%.2f",n);
}