Guest User

Untitled

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