fabs not working...

hello again! Today I attempted to write a program using the fabs function but it said that fabs was undeclared.... please help! Thanks in advance!

the code in question:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <stdlib.h>

using namespace std;

int main (int argc, char *argv[])
	{
		double start;
		double finnish;
		start = -253.895;
		finnish = fabs(start);
		cout << finnish;

		return 0;
}
fabs is in the cmath library so you must #include <cmath> before main.
Last edited on
thanks that really helped!
Topic archived. No new replies allowed.