Guest User

Untitled

a guest
Dec 12th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. 0x6E8FD4EC (ucrtbased.dll) в Lab 24.exe: 0xC0000005:
  2. нарушение прав доступа при записи по адресу 0x00500000.
  3.  
  4. #include <string.h>
  5. #include <iostream>
  6. #include <Windows.h>
  7. #include <conio.h>
  8. #include <stdio.h>
  9.  
  10. int main()
  11. {
  12. printf("Введите текст");
  13. char str[256], tmp;
  14. gets_s(str);
  15. int n = strlen(str), count;
  16. printf("Введите букву:");
  17. char t;
  18. scanf_s("%s", &t);
  19. for (int i = 0; i < n; i++)
  20. {
  21. if (str[i] == t)
  22. {
  23. if (str[i - 1] == 32 && i != 0 || i == 0)
  24. {
  25. count = 0;
  26. while (str[i] != 32 && i < n)
  27. {
  28. i++;
  29. count++;
  30. }
  31. if (str[i - 1] == ',')
  32. for (int j = i - count; str[j] != ','; j++)
  33. printf("%s", str[j]);
  34. printf(" ");
  35.  
  36. }
  37. }
  38. }
  39. system("pause");
  40. return 0;
  41. }
Add Comment
Please, Sign In to add comment