long long int ? help

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

Moderator: Board moderators

Post Reply
Eric____
New poster
Posts: 8
Joined: Thu Jan 30, 2003 10:13 am
Contact:

long long int ? help

Post by Eric____ » Sat Mar 01, 2003 10:53 am

from past posts, i saw discussion on using long long int
for example
[cpp]{
unsigned long long ull = 0xffffffffffffffff; // 18446744073709551615
[/cpp]

when i compiled this, i got error saying long followed by long s illegal,
is it problem w/ the compiler? plz help.[/cpp]

suman
New poster
Posts: 45
Joined: Fri Oct 19, 2001 2:00 am
Contact:

How about this?

Post by suman » Sat Mar 01, 2003 4:35 pm

How about this?
[cpp] #ifdef _MSC_VER
typedef _int64 Long;
typedef _int32 Int;
typedef unsigned _int64 ULong;
typedef unsigned _int32 UInt;
#elif __GNUC__
typedef long long Long;
typedef long Int;
typedef unsigned long long ULong;
typedef unsigned long UInt;
#elif __BCPLUSPLUS__
typedef __int64 Long;
typedef __int32 Int;
typedef unsigned __int64 ULong;
typedef unsigned __int32 UInt;
#else
typedef long Long;
typedef int Int;
typedef unsigned long ULong;
typedef unsigned int UInt;
#endif

void main()
{
ULong ull = 0xffffffffffffffff; // 18446744073709551615
}
[/cpp]

Does it work?

- Suman

Eric____
New poster
Posts: 8
Joined: Thu Jan 30, 2003 10:13 am
Contact:

--

Post by Eric____ » Sun Mar 02, 2003 10:12 am

works! thanks!

but how do u print it out?

eric

suman
New poster
Posts: 45
Joined: Fri Oct 19, 2001 2:00 am
Contact:

I/O?

Post by suman » Sun Mar 02, 2003 5:41 pm

You mean I/O? Use cin or cout.
:wink:

-Suman

Post Reply

Return to “C++”