Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <locale.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int ASCI(char*);
- /////////////////////////////////////
- int main()
- {
- system("chcp 1251 > nul");
- SetConsoleTitle("ОтветыМейлРу"); // Русские буквы
- int spc=0;
- char str[100]=
- "***Первый*пробел**в**позиции**-0.Следующие*хрен*их*знает*где.Вместо*пробела*звёздочка.**";
- printf("%s\n", str);
- char smb; int pos=strlen(str);
- while (str[pos]!='*') { spc++; pos--; }
- pos=0;
- if (str[0]=='*') { spc++; }
- pos++;
- while (str[pos]!='\0')
- {
- if (str[pos]=='*')
- {
- if (str[pos-1]=='*') { spc++; goto NXT; }
- if (ASCI(str[pos+1])==0 && str[pos]!='*') { spc++;}
- }
- NXT: pos++;
- }
- printf("Найдено %d лишних пробелов\n", spc);
- printf("\n"); system("pause");
- return 0;
- }
- int ASCI(char* smb)
- {
- if (smb>='A' && smb<='Z') return 1;
- if (smb>='a' && smb<='z') return 1;
- if (smb>='А') return 1;
- if (smb=='Ё' || smb=='ё') return 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement