| | |
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: Stack overflow issue
- Next Thread: VC++ 6.0: Outputting value in register?
| Thread Tools | Search this Thread |
add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count data delete desktop directshow dll download dynamic encryption error file forms fstream function functions game getline google graph gui homeworkhelper iamthwee ifstream input int integer java lib library linkedlist linker linux loop looping loops map math matrix memory microsoft multidimensional newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive return string strings struct studio template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






