0

Is it possible for someone to see and fix the error in the code?

#include<iostream> using namespace std; int main() { int col1 = 2,col2=4, row = 9, i, j; int** seat = new int* [row]; for (int i = 0; i < 3; i++) { seat[i] = new int[col1]; } for (int i = 3; i < row; i++) { seat[i] = new int[col2]; } seat[0][0] = 11; seat[3][0] = 41; for (i = 0; i < 3; i++) { for (j = 0; j < col1; j++) { seat[i][j + 1] = seat[i][j] + 1; seat[i + 1][j] = seat[i][j] + 10; } } for (i = 3; i < row; i++) { for (j = 0; j < col2; j++) { seat[i][j + 1] = seat[i][j] + 1; seat[i + 1][j] = seat[i][j] + 10; } } for (int i = 0; i < 3; i++) { for (int j = 0; j < col1; j++) { cout<< seat[i][j]<<" "; } cout << endl; } for (int i = 3; i < row; i++) { for (int j = 0; j < col2; j++) { cout << seat[i][j] << " "; } cout << endl; } return 0; }

12th Jun 2022, 3:44 PM
Dęęmā Jābī
Dęęmā Jābī - avatar
1 Answer
+ 1
Sure, it's possible. You could help them to want to help you by tagging the programming language in your original post and putting this code into the code playground and then attach it here.
12th Jun 2022, 9:21 PM
Ausgrindtube
Ausgrindtube - avatar