`
jishublog
  • 浏览: 869409 次
文章分类
社区版块
存档分类
最新评论

[总结]hdoj2003

 
阅读更多

克服惯性。

2003求绝对值:
Input

输入数据有多组,每组占一行,每行包含一个实数。
Output
对于每组输入数据,输出它的绝对值,要求每组数据输出一行,结果保留两位小数
Sample Input
123 -234.00
Sample Output
123.00 234.00
代码:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
	double x;
	while(scanf("%lf",&x)!=EOF)
	{
		if(x<0)  x=-x;
		printf("%.2f\n",x);
	}	
	return 0;
} 


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics