Please figure out the error in the code and how to correct it ?
Actually i want to use a 2d dynamic array.
# include <iostream>
using namespace std;
int main()
{
int number_of_rows = 0;
int number_of_cols = 0;
int a=0;
cout<<"Please enter the no. of rows : ";
cin>>number_of_rows;
cout<<"Please enter the no. of rows : ";
cin>>number_of_cols;
int* seats = new int[number_of_rows * number_of_cols];
for(int i=0;i<number_of_rows;i++)
{
for(int j=0;j<number_of_cols;j++)
{
if(seats[i][j]==0)
++a;
}
}
cout<<"The total number of reserved seats is : "<<(number_of_rows * number_of_cols)-a<<endl;
cout<<"The total number of un-reserved seats is : "<<a<<endl;
return 0;
}