answer each of the following, in pargagraph form describe the conceptual model o
ID: 3540386 • Letter: A
Question
answer each of the following, in pargagraph form
describe the conceptual model of a three-dimensional array. Include in your explanation how a three-dimensional array might be used and provide an example of one. (Points : 10)
Explanation / Answer
1)describe the conceptual model of a three-dimensional array.
Include in your explanation how a three-dimensional array might be used and provide an example of one. (Points : 1
three dimensional array will be declared as follows
int three_D[3][4][5];
which indicates the three dimensional array
array can be set as follows
for(int i=0; i<3; i++)
for(int j=0; j<4; j++)
for(int k=0; k<5; k++)
three_D[i][j][k] = 0;
2) Given a two-dimensional array named number of three rows and four columns of type int,
write the single code statement that will both declare and initialize the array such that the first row is initialized to 0, 1, 2, 3;
the second row is initialized to 4, 5, 6, 7;
and the third row is initialized to 8, 9, 10, 11. (Points : 10)
int array[3][4];
for(int i=0; i<4; i++)
for(int j=0; j<3; j++)
array[i][j] = 4*j + (i);
3) Develop a class definition that models an employee.
Include private and public member functions and variables.
Demonstrate how the class would be instantiated and how class members would be accessed.
class employee
{
private:
int account;
string name;
public:
employee(int ac=0,string nam="")
{
account = ac;
name = nam;
}
string get_name()
{
return name;
}
int get_account()
{
return account;
}
};