HDU_oj_2003 求绝对值

Problem Description
 
求实数的绝对值。
 
Input
输入数据有多组,每组占一行,每行包含一个实数。
 
Output
对于每组输入数据,输出它的绝对值,要求每组数据输出一行,结果保留两位小数。
 
Sample Input
123
-234.00
 
Sample Output
123.00
234.00
 
分析:
注意点:
 
 
 1 #include<iostream>
 2 using namespace std;
 3 
 4 int main()
 5 {
 6     double r;
 7     while(cin>>r)
 8     {
 9         if(r<0)
10         r=-r; 
11         printf("%.2f
",r);
12     }
13 }
 
原文地址:https://www.cnblogs.com/tenjl-exv/p/7966820.html