Hello! I am new to c++, here is my assignment :):
My job is to write a class TwoDimArray implementing a 2-dimensional array of ints as an abstract data type. You will implement ADT as a ragged array, (using an array of pointers to Array objects). You may use the Array class to implement the one-dimensional arrays of integers for the rows of your 2-dimensional array.
My question is when I get new rows and columns, how can I read them in and pass them out through my read and print method...
Your going to have to be more specific with your questions. Start working on the code and ask specific questions. Then we will be able to help you more.
As for your question.
void addValue(int X, int Y, int Value);
Is how you read them in. See how vague your question is.
If you want to use a ragged array. You should use a vector of vectors to accomplish this easily.
a simple for loops works well for me anytime I do arrays
1 2 3
for (i = 0; i < arrayDim1; i++){
for (j = 0; j < arrayDim2; j++){
cin>>array[i][j];
I'm not sure what you were trying to get at with your question, but I hope that helps you somewhat. I normally have it as a function in most of my programs, one to read in and one to print out.