Advertisement
Guest User

Untitled

a guest
Feb 19th, 2021
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. #include <windows.h>
  2. #include <locale.h>
  3. //#include <string.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. void RusPrint(void);
  8.  
  9. short int FindSMB(const char*, char*);
  10.  
  11. int main()
  12. {
  13. RusPrint(); // Русские буквы
  14.  
  15. char StrUse[100]= "Поиск \"char\\ в StrUse. Возврат позиции!";
  16. short int p; char* ch='\\';
  17.  
  18. printf("%s\n", StrUse);
  19.  
  20. p= FindSMB(StrUse, 'z'); printf("Найден символ '%c' в позиции %d\n", 'z', p);
  21. p= FindSMB(StrUse, '+'); printf("Найден символ '%c' в позиции %d\n", '+', p);
  22.  
  23. //p= FindSMB(StrUse, '"'); printf("Найден символ '%c' в позиции %d\n", '"', p);
  24. //p= FindSMB(StrUse, ch); printf("Найден символ '%c' в позиции %d\n", ch, p);
  25.  
  26. //p= FindSMB(StrUse, 't'); printf("Найден символ '%c' в позиции %d\n", 't', p);
  27. //p= FindSMB(StrUse, 'S'); printf("Найден символ '%c' в позиции %d\n", 'S', p);
  28.  
  29. //p= FindSMB(StrUse, 'п'); printf("Найден символ '%c' в позиции %d\n", 'п', p);
  30. //p= FindSMB(StrUse, 'П'); printf("Найден символ '%c' в позиции %d\n", 'П', p);
  31.  
  32. //p= FindSMB(StrUse, ' '); printf("Найден символ '%c' в позиции %d\n", ' ', p);
  33. //p= FindSMB(StrUse, '!'); printf("Найден символ '%c' в позиции %d\n", '!', p);
  34.  
  35. printf("\n"); system("pause"); return 0;
  36. }
  37. //////////////////////
  38. short int FindSMB(const char* strUser, char* chUser)
  39. {
  40. static short int a=0;
  41.  
  42. while (strUser[a]!='\0')
  43. {
  44. if (strUser[a]==chUser) return a;
  45. a++;
  46. }
  47. return -1;
  48. }
  49.  
  50. //////////////////////
  51. void RusPrint(void)
  52. {
  53. //Руссификация сообщений
  54.  
  55. setlocale(LC_ALL, "rus");
  56. SetConsoleOutputCP(1251);
  57. SetConsoleCP(1251);
  58.  
  59. SetConsoleTitle("ОтветыМейлРу");
  60.  
  61. return;
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement