I don’t know why my code is not working
http://www.spoj.com/problems/TOANDFRO/
int main()
{
char a[100][100];
int n,i,j,p,q;
cin>>n;
if(n==0)
exit(0);
for(i=0;i<40;i++)
{
for(j=0;j<n;j++)
{
cin.get(a[i][j]);
if(a[i][j]=='\n') //I am exiting when user enters the enter button
goto jump;
}
}
jump:
// cout<<i<<"\n"<<n<<"\n //I was testing whether the values of i & j are correct but value of j is not corrrect
for(p=0;p<n;p++)
{
for(q=0;q<i;q++)
{
cout<<a[q][p];
}
}
return 0;
}