| | |
can long long stor 12 dig num?ifno, without array how 2 do?
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
From this thread I would suggest you to use: 
>can long long store 12 digit numbers.
Depends on what your compiler is...
unsigned long long 
>can long long store 12 digit numbers.
Depends on what your compiler is...
Last edited by tux4life; Jun 8th, 2009 at 4:31 pm.
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
•
•
Join Date: May 2009
Posts: 10
Reputation:
Solved Threads: 0
this is my code. Problem as described above.
We have to find largest prime factor of a number.
the error i get is:
integer constant is too large for ‘long’ type
i don't want to use array.
We have to find largest prime factor of a number.
C++ Syntax (Toggle Plain Text)
#include<iostream> using namespace std; int main() { long long num=600851475143,large,k,i; for(i=2;;++i) { k=i; if(num%i==0) { num/=i; i=k-1; large=k; } if(num==1) break; } cout<<large; return 0; }
integer constant is too large for ‘long’ type
i don't want to use array.
>i don't want to use array.
In that case there's probably no other choice left than choosing for a Big Number library like GNU MP, it can handle much bigger numbers than a standard C++ datatype can...
And take a look at Salem's post as well:
In that case there's probably no other choice left than choosing for a Big Number library like GNU MP, it can handle much bigger numbers than a standard C++ datatype can...
And take a look at Salem's post as well:
- What is your compiler?
- What is your OS?
Last edited by tux4life; Jun 8th, 2009 at 4:36 pm.
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
![]() |
Similar Threads
Other Threads in the C++ Forum
- Previous Thread: Very simple Boost program giving me "undefined reference"?
- Next Thread: VC++ 6.0: Outputting value in register?
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






