Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <conio.h>
  2.  
  3. #include <string.h>
  4.  
  5. #include <stdio.h>
  6.  
  7. #include <ctype.h>
  8.  
  9. #include <windows.h>
  10.  
  11. #define MAX_SIZE 100
  12.  
  13. void upper(char* str);
  14.  
  15. int main()
  16.  
  17. {
  18.  
  19. char str[MAX_SIZE] = { '\0' };
  20.  
  21. int i = 0;
  22.  
  23. SetConsoleCP(1251);
  24.  
  25. SetConsoleOutputCP(1251);
  26.  
  27. printf("Программа в каждом слове строки все последующие вхождения первого символа записывает заглавной буквой.\nВведите строку:");
  28.  
  29. while (str[0] == '\0')
  30.  
  31. gets_s(str);
  32.  
  33. upper(str);
  34.  
  35. printf("Строка - результат:%s", str);
  36.  
  37. _getch();
  38.  
  39. }
  40.  
  41. void upper(char* str)
  42.  
  43. {
  44.  
  45. char symb = str[0];
  46.  
  47. for (int i = 0; i < MAX_SIZE; i++)
  48.  
  49. if (str[i] == symb)
  50.  
  51. str[i] = toupper(str[i]);
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement