Using really long values in C programming

View previous topic View next topic Go down

Using really long values in C programming

Post by BIT0122-Amit on Tue Aug 04, 2009 2:26 pm

I guess we all had problem when we tried to use really long values in C programming.
However, when there is a problem, there is a solution Wink

Limits header file gives the facility to use value upto....

18446744073709551615!!!

Go to this link for the details Wink

http://home.att.net/~jackklein/c/inttypes.html#limits

king

_________________________________________________________________
Adminship / Moderatorship is not about power, it is about Responsibility.

|About me|My Blog|
avatar
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

View user profile http://iitdu.forumsmotion.com

Back to top Go down

Re: Using really long values in C programming

Post by BIT0122-Amit on Tue Aug 04, 2009 11:56 pm

I have created a demo program to illustrate the examples in the link I gave below.
Code:

#include<stdio.h>
#include<iostream.h>
#include<conio.h>
#include<limits.h>
//using namespace std;

int main(){
   unsigned long long me=0;

   for(me=0;me<184467440737095516145;me++) {
   cout<<me<<"\n";
//In case you want to stop this program and see the progress:
//   if((me%10000000000000)==0) getch();
   }

   getch();
   return 0;
}

_________________________________________________________________
Adminship / Moderatorship is not about power, it is about Responsibility.

|About me|My Blog|
avatar
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

View user profile http://iitdu.forumsmotion.com

Back to top Go down

Re: Using really long values in C programming

Post by BIT0104-ANIK on Tue Jan 19, 2010 10:27 am

Even with the climits, the program given in your link shows the values of unsigned long long the same as before. And your program shows the same error as before. I'm trying.

_________________________________________________________________
Buddhong shoronogocchami..
dhommong shoronogocchami..
shonghong shoronogocchami..
Jogoter sokol prani.. shukhi hok.
avatar
BIT0104-ANIK
Administrator
Administrator

Course(s) :
  • BIT

Blood Group : O+
Posts : 423
Points : 699

View user profile http://anikstech.blogspot.com

Back to top Go down

Re: Using really long values in C programming

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum