SHARE
TWEET

Untitled

a guest Mar 24th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top