+ 1
Why cpp show me a error when I write this: string c[n][m];
10 Respostas
+ 1
The first element is at array[0], not array[1]. This could be the reason.
0
I know it work with it but you don't with this m n
0
I dont have declaration size of array
0
yes
0
look my code
0
#include <iostream>
using namespace std;
int main (){
int n,m,i,j;
cin>>n;
char a[n];
for (i=1;i<=n;i++)
cin>>a[i];
cin>>m;
string c[m][n];
char b[m];
for (i=1;i<=m;i++)
cin>>b[i];
for (i=1;i<=n;i++)
for (j=1;j<=m;j++)
c[i][j]=a[i]+b[j];
for (i=1;i<=n;i++){
for (j=1;j<=m;j++)
cout<<c[i][j]<<" ";
cout<<endl;
}
}
0
yes
0
no output
0
I try but nothing
0
make a 2d array with don't declaration size type string