abs function

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
Giorgi
New poster
Posts: 48
Joined: Wed Jun 07, 2006 6:26 pm
Location: Georgia Tbilisi

abs function

Post by Giorgi »

hi, I'm begginer in c++
why abs function gives me CE? it works in my compiler;
asif_rahman0
Experienced poster
Posts: 209
Joined: Sun Jan 16, 2005 6:22 pm

Post by asif_rahman0 »

UVa changed their compiler(may be).
So use:-

Code: Select all

#include <cstdlib>
....
int abs(){}
...
Its save.
Last edited by asif_rahman0 on Wed Aug 23, 2006 11:04 pm, edited 1 time in total.
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Re: abs function

Post by Martin Macko »

Giorgi wrote:hi, I'm begginer in c++
why abs function gives me CE? it works in my compiler;
The following code doesn't get CE on OJ:
code.cc wrote:#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

int main(void)
{
........double a=-7.0;
........int b=-6;

........printf("%lf %d\n", abs(a), abs(b));
........return 0;
}
Giorgi
New poster
Posts: 48
Joined: Wed Jun 07, 2006 6:26 pm
Location: Georgia Tbilisi

Post by Giorgi »

thankx :)
Post Reply

Return to “C++”