HDU 2003 求绝对值(水~)

来源:互联网 发布:nginx 跳转到子目录 编辑:程序博客网 时间:2024/05/22 16:59

Description
求实数的绝对值
Input
输入数据有多组,每组占一行,每行包含一个实数
Output
对于每组输入数据,输出它的绝对值,要求每组数据输出一行,结果保留两位小数
Sample Input
123
-234.00
Sample Output
123.00
234.00
Solution
水题
Code

#include<iostream>#include<cstdio>using namespace std;int main(){    double x;    while(scanf("%lf",&x)!=EOF)    {        x=x>0?x:-x;        printf("%.2lf\n",x);    }    return 0;}
0 0
原创粉丝点击