Guest User

Untitled

a guest
Oct 17th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. //Nolan Taeksang Yoo and Josh Bulos
  2.  
  3. #include <stdio.h>
  4. #include <ctype.h>
  5.  
  6. typedef enum
  7. {start, identifier, number, stop, build_num, build_id}
  8. current_state;
  9.  
  10. int main()
  11. {
  12. char input[100];
  13. char doubleinput[100];
  14. int size, address, place1, place2, place3, place4, place5;
  15.  
  16. printf("Please enter a noun (\"Done\" = exit): ");
  17. fgets(input, 1000, stdin);
  18. strcpy(doubleinput, input);
  19. size = strlen(input);
  20. place1 = size - 1;
  21. place5 = size - 2;
  22.  
  23. if (input[place1] == 's')
  24. {
  25. place2 = place1 + 1;
  26. place3 = place1 + 2;
  27. place4 = place1 + 3;
  28. input[place2] = 'e';
  29. input[place3] = 's';
  30. input[place4] = '\0';
  31. }
  32.  
  33. if (input[place5] == 'c' || input[place5] == 's')
  34. {
  35. if (input[place1] == 'h')
  36. {
  37. place2 = place1 + 1;
  38. place3 = place1 + 2;
  39. place4 = place1 + 3;
  40. input[place2] = 'e';
  41. input[place3] = 's';
  42. input[place4] = '\0';
  43. }
  44. }
  45. if (input[place1] == 'y')
  46. {
  47. place2 = place1 + 1;
  48. place3 = place1 + 2;
  49. place4 = place1 + 3;
  50. input[place1] = 'i';
  51. input[place2] = 'e';
  52. input[place3] = 's';
  53. input[place4] = '\0';
  54. }
  55. if (input != "Done")
  56. printf("The plural of %c is %c.\n", doubleinput, input);
  57. return(0);
  58. }
Add Comment
Please, Sign In to add comment