| | |
Large numbers
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: May 2009
Posts: 14
Reputation:
Solved Threads: 0
so you mean use long long or __int64 like for example
long long variable; or __int 64 variable;
variable = value;
display variable?
if yes that didnt work for me in both cases.
If im wrong can you please send some code so that i can understand better what you mean?
thanks
long long variable; or __int 64 variable;
variable = value;
display variable?
if yes that didnt work for me in both cases.
If im wrong can you please send some code so that i can understand better what you mean?
thanks
Last edited by kostasxx; Jun 18th, 2009 at 12:49 pm.
•
•
Join Date: Mar 2008
Posts: 1,488
Reputation:
Solved Threads: 123
C Syntax (Toggle Plain Text)
#include <stdio.h> int main( void ) { // how can i store a 12 digit number? long long num = 123456789123; // print that number using a variable printf( "%lld", num ); return 0; }
Last edited by William Hemsworth; Jun 18th, 2009 at 1:24 pm.
I need pageviews! most fun profile ever :)
•
•
Join Date: Mar 2008
Posts: 1,488
Reputation:
Solved Threads: 123
I need pageviews! most fun profile ever :)
•
•
Join Date: Jun 2009
Posts: 5
Reputation:
Solved Threads: 0
long long blahblahquack = 930342;
blahblahquack *= 1000000;
blahblahquack += 900243;
do_something(blahblahquack);
-----
or you could make a function:
long long from_thousands(int a, int b, int c, int d, int e){
long long ans = 0;
ans += a; ans *= 1000;
ans += b; ans *= 1000;
ans += c; ans *= 1000;
ans += d; ans *= 1000;
ans += e;
}
long long blahblahquack = from_thousands(0,930,342,900,243);
If you want to code it in C#, the code is cleaner -- use an object[] .
blahblahquack *= 1000000;
blahblahquack += 900243;
do_something(blahblahquack);
-----
or you could make a function:
long long from_thousands(int a, int b, int c, int d, int e){
long long ans = 0;
ans += a; ans *= 1000;
ans += b; ans *= 1000;
ans += c; ans *= 1000;
ans += d; ans *= 1000;
ans += e;
}
long long blahblahquack = from_thousands(0,930,342,900,243);
If you want to code it in C#, the code is cleaner -- use an object[] .
•
•
Join Date: Mar 2008
Posts: 1,488
Reputation:
Solved Threads: 123
>If you want to code it in C#, the code is cleaner -- use an object[]
Don't bother suggesting another language, we're in the C forum and we can assume the OP wants to use C, unless he says so himself that he's undecided.
Either way, that post didn't solve his problem. I don't use Dev, but your best bet would be to search the problem on google.
Don't bother suggesting another language, we're in the C forum and we can assume the OP wants to use C, unless he says so himself that he's undecided.
Either way, that post didn't solve his problem. I don't use Dev, but your best bet would be to search the problem on google.
I need pageviews! most fun profile ever :)
![]() |
Similar Threads
- (very) simple math not working perhaps due to to large numbers? (C++)
- help, large numbers (C++)
- Large Numbers (PHP)
- Store large numbers in C (C++)
- storing large numbers (C++)
Other Threads in the C Forum
- Previous Thread: Lost with bitwise
- Next Thread: Reading Problem in C
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays asterisks binarysearch calculate centimeter char convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile csyntax directory drawing dynamic executable fflush file fork frequency getlasterror givemetehcodez graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop initialization interest km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling scripting segmentationfault send shape socketprograming spoonfeeding stack standard string strings structures student suggestions systemcall test testautomation unix user variable voidmain() wab win32api windows.h






