Hello everyone,

If i need my program to create as much vectors as needed based on the user first input , assuming each vectors will hold an int value like a combinations of numbers, so latter those vectors will be compared for higher value.

prompt the user to enter how many vectors needed for this program ,

now user will enter their first vectors value followed by second , and third.

I was thinking of having a loop, but not sure yet how should I create those different dynamic vectors variables in a way to distinguish each one from the others so I can pass them differently into my other methods for comparison and calculation.
I'm new to vectors that's why this might seems silly for some ppl but its little confusing for me.

Thank you.

Yes sir , i sure do.
do you know programing ???
any other comment related to my question are appreciate it.

I don't quite understand why you need to store each int in a array. Wouldn't it be simpler to have a single array of int's? Anyway, if you want it like that you can use a pointer to a array of int arrays. Then you can use each array by the index. Like below:

int nrOfVectors;
std::cout << "Enter the number of vectors: ";
std::cin >> nrOfVectors;
int** n = new int* [nrOfVectors];
for (int x = 0; x < nrOfVectors; ++x)
    // here you could also input each array size instead of 5
    n[x] = new int[5];
    for(int j = 0; j < 5; ++j)
        // enter each digit of the int in n[x]

// now you can simply use n[0] or n[1] or whatever array you want.

But in the end I still say it's simpler to use a single array of int's.

Thank you so much lon 1.
its a requirement for the assignment that i'm working on. i see the concept and that's all matter. true, i know it can get ugly especially when i start calculating and passing values through other methods.
thanks again.

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.