Ok i have an assignment that required me to create a simple database using C++. I tried using both ways which is structures and 2d arrays. But it just keep crashing the command prompt!! Can somebody take a look at the code and tell me the problem? Thank you very much in advance. P.S: I am new to programming. I can hardly understand classes so please be detailed in your explaination.
---------------------------------------------------------------
the structure program
------------------------------------------------------------

#include <iostream>

using namespace std;


int add_record()
{struct weapon
{int id;
int name;
int quantity;
};

int i,k,size,l;
i=1;
l=0;
k=1;
size=0;
weapon add[size];
cout<< "Enter size of record"<< endl;
cin>> size;


for( l=0; l<size;l++)
{
cin>> add[l].id;
}



for( l=0; l<size;l++)
{
cout<< add[l].id<< endl;
}

return 0;
}
int main()
{
add_record();

system ("PAUSE");
return 0;
}


=========================================================
the array prog
=========================================
#include <iostream>

using namespace std;

int main()
{int row, a,b;
b=0;
const int column=3;
char weapon [row][column];
row=1;
cout<< "Please enter row "<< endl;
cin>> row ;

for ( a=0; a<row; a++)
{b=0;
for (b=0; b<3; b++)
{ cout << "Enter id, quantity,name" <<endl;
cin>>weapon[a][b];
}
};

for ( a=0; a<row; a++)
{b=0;
for (b=0; b<3; b++)
{
cout<< weapon[a][b]<< " ";
}

cout<< endl;
};
system ("pause");
return 0;
}


_--------------------------------------------------------------------------------