using vector Library i need to put a miliard numbers of int and string into a container and cout the 26's member and 968677727 member,can you help me with this task?
hmmm maybe i translated the task wrong i will try to explain as good as i can :
Using library vector. into the Container put a miliard Objects,that are from random int and random string type and cout to the screen the object 26 and object 96867772
i hope i made a better explanation,this i my exam task and i made the first task this is the seconde and i just dont get it i havent been learnin this yet.
Unless you have monster machine with 16Gb RAM onboard trying to allocate 1 000 000 000 values with standard library vector is likely to give you an bad_alloc exception. There is code for vector of int, but it probably will crash on you because of insufficient RAM:
i know about the problem of ram i asked my teacher if its trully is the task he said yes and said you have to use it as object,said you have to use class and public and show and something else to make it happen.
Even if you use object which will hold integer and string, you std::vector of pointer to said objects is still will be almost 4Gb on 32x machine. And I even not started to count actual memory consumption of objects.
EDIT: Even the vector of ints if about 4Gb, what can you think about vector of ints and strings?
It's likely you don't need to run the actual program, so what you could do is design it for 1000 of those objects, make sure it works, then modify it for 100,000,000 objects without running it (but compiling)