Could you specifically show me where in here it goes cause I'm stupid or something and it's stumped me for a week or so now.
Code:
#include <stdio.h>
/* This function takes all the characters and makes them UPPERCASE */
int LowUpp(int ch)
{
if ('a' <= ch && ch <= 'z')
{
return (ch + 'A' - 'a');
}
else
{
return ch;
}
}
char c; /* Initializes c */
int main()
{
int LowUpp(int ch);
/* The following delcares the variables to be used in the program */
char word[23];
char userstring[1024];
char Array[1024][100];
int wordcount = 0;
int charcount = 0;
int wordnumb = 0;
int i = 0;
int j = 0;
int row = 0;
int column = 0;
/* Next the Title and Enter your input are printed to the screen */
printf("Word & Character Counter\n\n\n");
printf("Enter your input ([CTRL+Z] To Quit): ");
/* This if statement takes in the string from the user */
if(fgets(userstring, 1024, stdin) == NULL)
return 0;
/* This prints the main parts of the table */
printf("\n\nWord Count ");
printf("Word ");
printf("Character Count \n");
printf("---------------------------------------------------------------\n");
/* This while loop continues as long as the userstring[i] is not null */
while(userstring[i] != '\0')
{
/* If the userstring is equal to a space AND return AND tab */
if((userstring[i] != ' ') && (userstring[i] != '\n') && (userstring[i] != '\t'))
{
/* Increments charcount */
charcount++;
/* Uses the LowUpp function on the input whichs turns in into uppercase */
word[j++] = LowUpp(userstring[i]);
}
else
{
/* Increments wordnumb */
wordnumb++;
word[j] = '\0';
/* Saves it to the array */
Array[row][column] = word[i];
/* If charcount is less than 8 */
if(charcount < 8)
/* Prints the input to the screen */
printf("%d\t\t\t%s\t\t\t%d\n", wordnumb, word, charcount);
else
/* Prints the input to the screen */
printf("%d\t\t\t%s\t%d\n", wordnumb, word, charcount);
/* Sets charcount to 0 */
charcount = 0;
/* Increments wordcount */
wordcount++;
/* Sets j equal to 0 */
j = 0;
}
/* Increments i */
i++;
}
/* Prints the end of the table to the screen */
printf("---------------------------------------------------------------\n");
printf("Total Words: %d\n\n", wordcount);
/* Returns 0 */
return 0;
}