标签:
#include<iostream> #include<cmath> #include<cstdio> using namespace std; int main() { float x; float res; while (cin >> x) { res = x>=0 ? x : -1 * x; printf("%.2f\n",res); } return 0; }
#include<iostream> #include<cmath> #include<cstdio> using namespace std; int main() { double x; double res; while (cin >> x) { res = x>=0 ? x : -1 * x; printf("%.2f\n",res); } return 0; }
标签:
原文地址:http://blog.csdn.net/geekmanong/article/details/51004906