abs
语法:
#include <stdlib.h>
int abs( int num );
功能: 函数返回参数num.的绝对值。例如:
int magic_number = 10;
cout << "Enter a guess: ";
cin >> x;
cout << "Your guess was " << abs( magic_number - x ) << " away from the magic number." << endl;
相关主题: