From word puzzle collect data in array 2 dimensions and display the results in the following figure.
example :
T TH THI THIS
H HI HIS
I IS
S
W WA WAT WATS
A AT ATS
T TS
S
I want to solve word puzzle and I can't to solve this because I don't know for loop work and I don't know how to set range of this loop so I want to know how can I set for loop for run word puzzle out like example and this question a[5] (array 2 dimensions type char) and this my code
int main()
{ int i,j,k;
char a[5] = "THIS";
for(k=0;k<4;k++)
{
for(i=0;i<4-k;i++)
{
for(j=0;j<=i;j++)
cout << a[j] << " ";
cout << " ";
}
cout << endl;
}
}
but this code run is
T TH THI THIS
T TH THI
T TH
T