Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <string.h>
  4. using namespace std;
  5.  
  6. const size_t N = 120;
  7. char* mystrchr(char arr[]);
  8. int main() {
  9. typedef char cha[N];
  10. system("chcp 1251 > null");
  11. cha A;
  12. char key = 's';
  13. char *result;
  14. cout << "Π’Π²ΠΎΠ΄: ";
  15. gets_s(A);
  16. result = mystrchr(A);
  17. cout << result;
  18. return 0;
  19. }
  20. char* mystrchr(char A[N])
  21. {
  22. int i = 0;
  23. char* j;
  24. while (A[i] != '\0') {
  25. if (A[i] == 's') {
  26. j = &A[i];
  27. return j;
  28. }
  29. i++;
  30. }
  31. return nullptr;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement