Cin.getline() doubt

can cin.getline() be used for 2D array for printing matrix of large size such as 25?

Hello @supratik260699,

Can you please review your doubt?

cin. getline() – is used to read unformatted string (set of characters) from the standard input device (keyboard).

It is not used to print output.

If you wish to take input for a 2D character array using cin.getline() then you can do it the following way
Suppose the array is: char A[n][m];

for(int i=0;i<n;i++){
cin.getline(A[i],m);
}

Hope, this would help.
give a like if you are satisfied.

1 Like