Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <locale.h>
- //#include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- void RusPrint(void);
- short int FindSMB(const char*, char*);
- int main()
- {
- RusPrint(); // Русские буквы
- char StrUse[100]= "Поиск \"char\\ в StrUse. Возврат позиции!";
- short int p; char* ch='\\';
- printf("%s\n", StrUse);
- p= FindSMB(StrUse, 'z'); printf("Найден символ '%c' в позиции %d\n", 'z', p);
- p= FindSMB(StrUse, '+'); printf("Найден символ '%c' в позиции %d\n", '+', p);
- //p= FindSMB(StrUse, '"'); printf("Найден символ '%c' в позиции %d\n", '"', p);
- //p= FindSMB(StrUse, ch); printf("Найден символ '%c' в позиции %d\n", ch, p);
- //p= FindSMB(StrUse, 't'); printf("Найден символ '%c' в позиции %d\n", 't', p);
- //p= FindSMB(StrUse, 'S'); printf("Найден символ '%c' в позиции %d\n", 'S', p);
- //p= FindSMB(StrUse, 'п'); printf("Найден символ '%c' в позиции %d\n", 'п', p);
- //p= FindSMB(StrUse, 'П'); printf("Найден символ '%c' в позиции %d\n", 'П', p);
- //p= FindSMB(StrUse, ' '); printf("Найден символ '%c' в позиции %d\n", ' ', p);
- //p= FindSMB(StrUse, '!'); printf("Найден символ '%c' в позиции %d\n", '!', p);
- printf("\n"); system("pause"); return 0;
- }
- //////////////////////
- short int FindSMB(const char* strUser, char* chUser)
- {
- static short int a=0;
- while (strUser[a]!='\0')
- {
- if (strUser[a]==chUser) return a;
- a++;
- }
- return -1;
- }
- //////////////////////
- void RusPrint(void)
- {
- //Руссификация сообщений
- setlocale(LC_ALL, "rus");
- SetConsoleOutputCP(1251);
- SetConsoleCP(1251);
- SetConsoleTitle("ОтветыМейлРу");
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement