| | |
max int value?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
•
•
hey anyone know what the largest value that can be stored in an integer variable is?
•
•
•
•
likewise is there a double / long type of deal that isnt of float type?
•
•
Join Date: Feb 2005
Posts: 3
Reputation:
Solved Threads: 0
well if you have a float value that is too large for a normal float you can us a double to give it twice the normal memory usage...
i was wondering if there was an int type of variable to do the same.
i am basically working with addition of two hexadecimal numbers each of which can be up to 20 characters long, when i add two of these i am storing it in an int variable, and i am thinking the reason i am having problems with the output is becuase the answer it returns is too large to be stored in the int...
i was wondering if there was an int type of variable to do the same.
i am basically working with addition of two hexadecimal numbers each of which can be up to 20 characters long, when i add two of these i am storing it in an int variable, and i am thinking the reason i am having problems with the output is becuase the answer it returns is too large to be stored in the int...
A 20 character long hexadecimal value would exceed any of C++'s types. Try an arbitrary precision library such as GMP.
•
•
Join Date: Feb 2005
Posts: 3
Reputation:
Solved Threads: 0
well the project is for a intro level c++ class , so it seems like the prof wouldnt require us to do soemthin that required libraries other than the ones in code warrior to start with. im thinkin im gonna have to store the value as a character array and only convert it to actual numbers when i need to manipulate them, that way i dont have to deal w/ the whole thing as one huge number, jus go one slot at a time thru the array. thanks alot for speedy replies by the way
•
•
•
•
Originally Posted by jamboadams
hey anyone know what the largest value that can be stored in an integer variable is? likewise is there a double / long type of deal that isnt of float type? thanks
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <limits> int main(void) { std::cout << std::numeric_limits<int>::max() << std::endl; std::cout << std::numeric_limits<double>::max() << std::endl; return 0 ; } /* my output 2147483647 1.79769e+308 */
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
•
•
•
•
Originally Posted by jamboadams
im thinkin im gonna have to store the value as a character array and only convert it to actual numbers when i need to manipulate them
•
•
•
•
well the project is for a intro level c++ class , so it seems like the prof wouldnt require us to do soemthin that required libraries other than the ones in code warrior to start with. im thinkin im gonna have to store the value as a character array and only convert it to actual numbers when i need to manipulate them, that way i dont have to deal w/ the whole thing as one huge number, jus go one slot at a time thru the array. thanks alot for speedy replies by the way
"We Americans got so tired of being thought of as dumb by the rest of the world that we went to the polls last November and removed all doubt."
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
![]() |
Similar Threads
- Finding Max Number in Array (Java)
- my max function in my array wont work (C++)
- Colour picker, MouseDown(Event, int x, int y) Depreciation Help! (Java)
Other Threads in the C++ Forum
- Previous Thread: Dereference a generic object
- Next Thread: heap sort
| 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 dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline 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 url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






