by now I have this code
int main() {
int cols;
cout << "cols";
cin >> cols;
int rows;
cout << "rows";
cin >> rows;
char** charArray = new char*[rows];
for (int i = 0; i < rows; ++i) {
charArray[i] = new char[cols];
}
// Fill the array
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < cols; ++j) {
charArray[i][j] = char('1' + i + j );
}
}
// Output the array
for (int i = 0; i < rows; ++i) {
for (int j = i; j < cols ; ++j) {
cout << charArray[i][j];
}
cout << endl;
}
// Deallocate memory by deleting
for (int i = 0; i < rows; ++i) {
delete[] charArray[i];
}
and the output is like 1 2 3 2 3 4
How can I make it to be 1 2 3 4 5 6
I tried a lot, im a newbie in programming so can you please explain me what's the matter with this problem! Thanks a lot!!