Ok, so I re-indented to the best of my ability (first programming experience ever), and I also added in my attempt at the bubble sort down at the bottom.
Thanks
Code:
#include <stdio.h>
#include <string.h>
int main(void)
{
char Word[10][19];
int i, j, k, l, z;
int value;
int str;
char ch;
for(z=0 ; z<10 ; z++)
{
if (z == 0)
printf("Enter the 1st word: ");
else if (z == 1)
printf("Enter the 2nd word: ");
else if (z == 2)
printf("Enter the 3rd word: ");
else
printf("Enter the %dth word: ",z+1);
i=0;
while(( ch = fgetc(stdin)) != '\n')
{
i=i+1;
Word[z][i]= ch;
}
l=10;
for(k=i ; k>=1; k--)
{
Word[z][l]=Word[z][k];
l=l++;
}
Word[z][19]=i;
}
printf("\n");
printf("Unsorted Input: \n");
printf("\n");
for (z=0 ; z<10 ; z++)
{
for(j=10 ; j<=9+Word[z][19]; j++)
{
value = Word[z][j];
if (value >= 97 && value<=122)
{
value = value - 32;
}
else if (value >=67 && value<=90)
{
value = value + 32;
}
printf("%c", value);
}
for(j=1; j<=Word[z][19]; j++)
{
value = Word[z][j];
if (value >= 97 && value<=122)
{
value = value - 32;
}
else if (value >=67 && value<=90)
{
value = value + 32;
}
printf("%c", value);
}
putchar('\n');
}
printf("\n");
printf("Sorted Input: \n");
printf("\n");
/* Here is my attempt at the bubble sort for the 2dim char array */
for(i=0;i<l-1;i++) /* Not sure what for statements to grab from my code */
for(j=l-1;j>i;j--)
{
if(strcmp(Word[j],Word[j-1])<0)
{
strcpy(temp,Word[j]);
strcpy(Word[j],Word[j-1]);
strcpy(Word[j-1],temp);
}
}
for(i=0;i<l;i++) printf("%s\n",Word[z][j]);
scanf("%c", Word[z][j]);
}