I can't get my program to compile!!!

Saint Nick

Lifer
Jan 21, 2005
17,722
6
81
41 c:\programs\prc885~1.cpp
integer constant out of range

41 c:\programs\prc885~1.cpp
warning: decimal integer constant is so large that it is unsigned

I get those errors for variables n11 to n15. i set them as long long int, why would they still do this?

I am using Bloodshed Dev-C++ Version 4.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Look at the number you are using to divide X by.
You may need to recast it to a long long int.
 

Saint Nick

Lifer
Jan 21, 2005
17,722
6
81
Originally posted by: EagleKeeper
Look at the number you are using to divide X by.
You may need to recast it to a long long int.

I just tried that, didn't work, any other suggestions? Pleases?
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
I just tried this using VC 6.0

I changed your long long int to double.

Then at each calculation, I typecasted the result to an int

n15 = (int) (x / 1000000000000000) % 10;

Compiled fine
 

oog

Golden Member
Feb 14, 2002
1,721
0
0
long long int isn't guaranteed to be any particular size other than bigger than or equal to the size of a long int.
 

Saint Nick

Lifer
Jan 21, 2005
17,722
6
81
I think my problem here is that the Bloodshed compiler doesn't like the size of 1000000000000000.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Using doubles isn't a good idea because it'll be imprecise. Instead of dividing by ridiculously big numbers, divide by reasonable numbers (e.g. 1 billion) multiple times.