Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Nolan Taeksang Yoo and Josh Bulos
- #include <stdio.h>
- #include <ctype.h>
- typedef enum
- {start, identifier, number, stop, build_num, build_id}
- current_state;
- int main()
- {
- char input[100];
- char doubleinput[100];
- int size, address, place1, place2, place3, place4, place5;
- printf("Please enter a noun (\"Done\" = exit): ");
- fgets(input, 1000, stdin);
- strcpy(doubleinput, input);
- size = strlen(input);
- place1 = size - 1;
- place5 = size - 2;
- if (input[place1] == 's')
- {
- place2 = place1 + 1;
- place3 = place1 + 2;
- place4 = place1 + 3;
- input[place2] = 'e';
- input[place3] = 's';
- input[place4] = '\0';
- }
- if (input[place5] == 'c' || input[place5] == 's')
- {
- if (input[place1] == 'h')
- {
- place2 = place1 + 1;
- place3 = place1 + 2;
- place4 = place1 + 3;
- input[place2] = 'e';
- input[place3] = 's';
- input[place4] = '\0';
- }
- }
- if (input[place1] == 'y')
- {
- place2 = place1 + 1;
- place3 = place1 + 2;
- place4 = place1 + 3;
- input[place1] = 'i';
- input[place2] = 'e';
- input[place3] = 's';
- input[place4] = '\0';
- }
- if (input != "Done")
- printf("The plural of %c is %c.\n", doubleinput, input);
- return(0);
- }
Add Comment
Please, Sign In to add comment