Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

#include<iostream>

using namespace std;


void Addcolumns(int *&aptr, int size)
{
for (int i = 0; i < size; i++)
{
aptr = new int[i];
}
}
void rowWiseInput(int *aptr, int size)
{
cout << "Enter elements\n";
for (int j = 0; j <= size; j++)
{
cin >> aptr[j];
}
}
void rowWisePrint(int *aptr, int size)
{
cout << "This row is\n";
for (int j = 0; j <= size; j++)
{
cout << aptr[j];
}
cout << endl<<endl;
}

int main()
{
int row;
cout << "row:";
cin >> row;
cout << endl;
int **aptr;
aptr = new int*[row];
for (int i = 0; i<row; i++)
Addcolumns(*aptr, row);
for (int i = 0; i < row; i++)
{
rowWiseInput(*aptr, i);
rowWisePrint(*aptr, i);
}
cout << endl;
delete[]aptr;
system("pause");
return 0;
}

You might also like