Hey there.
Just beginning to learn c++ on my own(not easy).
Please fogive my lack of knowledge.


I have a list of large numbers(50 digits) that i copied.
I want to split them into an integer array of size [100][50].
I dont want to have to go through and put in all the commas(obviously >4000).
Does anyone have any suggestions for an easier way.

thanks in advance.

How are your list of large number stored? Presumably its stored in a .txt file
in a specific format. Can you give an example ?

was just copied off web page using ctrl c (project euler problem 13)
not in file
is a list of 100 50digit numbers
165..........567
................
................
765..........423
etc etc

It will be easier for you if you read that from a file. If not then you can just do this :

std::vector<string> listOfNum;
listOfNum.push_back( "37107287533902102798797998220837590246510135740250" );
listOfNum.push_back( "46376937677490009712648124896970078050417018260538" );
//...and so on

ok but will this all be char
need to work on the numbers mathematically
how to seperate them into individual integers?
planned to put in a 2D array
going to add these numbers together

if i have this wrong please correct me(still beginner) :)

You need to store them as characters because you cannot have an integer hold a 50 digit number. And if you try to use a float or double you will lose precision.

So store them as a character and come up with function that does math between 2 strings.

ok figured it out now thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.