From Wikibooks, open books for an open world
<
C++ Programming|
Code/Standard C Library|
Functions abs[edit | edit source] Syntax#include <cstdlib> int abs( int num );
The abs() function returns the absolute value of num. For example:
int magic_number = 10; cout << "Enter a guess: "; cin >> x; cout << "Your guess was " << abs( magic_number - x ) << " away from the magic number." << endl;
Retrieved from "
https://en.wikibooks.org/w/index.php?title=C%2B%2B_Programming/Code/Standard_C_Library/Functions/abs&oldid=3677091"
Category:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4