473,395 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Declaring a very long integer

How do I define 317584931803 as an integer in C++?
Sep 25 '07 #1
3 2601
RRick
463 Expert 256MB
Try the following definition. It works on some (?most?) C and C++ compilers.
Expand|Select|Wrap|Line Numbers
  1. long long int lli = 317584931803LL;
  2.  
  3. unsigned long long int ulli = 317584931803ULL;
  4.  
The LL and ULL tell the compiler what type of number you're dealing with. I don't believe they are absolutely necessary in the declaration.
Sep 25 '07 #2
I bow down to your superior knowledge of C++ :-) Thank you!!
If you remove the 'll' or the 'ull' the program does not work. FYI, I am using Dev.
Sep 25 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
And you should always check that your value ius within the max/min range of the type:
Expand|Select|Wrap|Line Numbers
  1. numeric_limits<long long int> val;
  2.     cout << val.max() << endl;
  3.     cout << val.min() << endl;
  4.  
Sep 25 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: shanx__=|;- | last post by:
hi i need some help regarding use of very very long integer datatype in 'c'.. i need it to store result of large number's factorial.. if someone can healp it would be a delight..
2
by: NG | last post by:
Hi All, I want to declare an interface in C#. I have the equivalent code for VB.NET but when I try to write the corresponding code in C#, it does not work. Can anyone please help me by...
3
by: noobee | last post by:
hi all... I have the following figures in my program 345.234 789.123 -345.892 -123.456 what do I declare them as?? long? integer? short? decimal?
6
by: dndfan | last post by:
Hello, In the short time I have spent reading this newsgroup, I have seen this sort of declaration a few times: > int > func (string, number, structure) > char* string > int number >...
16
by: dejavu33 | last post by:
Hi! I dont understand arrays very much. Im trying to create an array of up to 100 positive numbers with the use of -1 to stop entering if the user needs an array containing less than 100...
13
by: Jack B | last post by:
I'm using Access 2002 to create a database for a small opera company that my wife is involved in, and I'm more than a bit rusty because I haven't created a new Access database since about 1999. ...
8
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using vs2005, .net 2, C# for Windows application. I use DllImport so I can call up a function written in C++ as unmanaged code and compiled as a dll us vs2005. My application is able to...
5
by: Rahul B | last post by:
Hi, I have very little knowledge about creating Procedures/functions in DB2. When i tried to create the test function like CREATE FUNCTION GET_TEST (P_TEST_ID INTEGER, P_SEL_OR_SORT...
0
by: zephyrus360 | last post by:
This is about a technique to find the mod of a very large integer with a normal small integer. I recently encountered this problem when I needed to compute the modulus of a very large number with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.