40 Points !!!
Write a function which accepts an integer array and its size as argument and assign the elements into a 2D array of integers. If the 1 D array is { 1 2 3 } send output will be
1 2 3
1 2 0
1 0 0
C++ || Class 11 || Computer
Share
40 Points !!!
Write a function which accepts an integer array and its size as argument and assign the elements into a 2D array of integers. If the 1 D array is { 1 2 3 } send output will be
1 2 3
1 2 0
1 0 0
C++ || Class 11 || Computer
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
{
int b[10][10],i,j;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
if(i>=j)
b[i][j]=a[j];
else
b[i][j]=0;
}
for(i=0;i<n;i++)
{ cout<<endl;
for(j=0;j<n;j++)
cout<<b[i][j]<<" ";
}
I hope it help you