c++ - Reading a 2D Array from the console -


i'm trying read 2-dimensional array console code wrong , reads twice last line, doing wrong??

example input:

1

01

10

output:

10

10

    int n;     cin>>n;     char *a=new char[n,n];      for(int i=0; i<n; i++)     {         for(int j=0; j<n; j++)         {             cin>>a[i,j];         }         cin.ignore();     } 

looking @ code take trying make 2d array dynamic size, syntax wrong declaring populating array. think of 2d array array of pointers array. question has been asked , answered:

how declare 2d array in c++ using new?


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -