Advertisement
Guest User

Untitled

a guest
Apr 30th, 2021
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #include <windows.h>
  2. #include <locale.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6.  
  7. int ASCI(char*);
  8.  
  9. /////////////////////////////////////
  10. int main()
  11. {
  12. system("chcp 1251 > nul");
  13. SetConsoleTitle("ОтветыМейлРу"); // Русские буквы
  14.  
  15. int spc=0;
  16.  
  17. char str[100]=
  18. "***Первый*пробел**в**позиции**-0.Следующие*хрен*их*знает*где.Вместо*пробела*звёздочка.**";
  19. printf("%s\n", str);
  20.  
  21. char smb; int pos=strlen(str);
  22. while (str[pos]!='*') { spc++; pos--; }
  23. pos=0;
  24. if (str[0]=='*') { spc++; }
  25. pos++;
  26. while (str[pos]!='\0')
  27. {
  28. if (str[pos]=='*')
  29. {
  30. if (str[pos-1]=='*') { spc++; goto NXT; }
  31. if (ASCI(str[pos+1])==0 && str[pos]!='*') { spc++;}
  32. }
  33. NXT: pos++;
  34. }
  35. printf("Найдено %d лишних пробелов\n", spc);
  36. printf("\n"); system("pause");
  37. return 0;
  38. }
  39.  
  40. int ASCI(char* smb)
  41. {
  42. if (smb>='A' && smb<='Z') return 1;
  43. if (smb>='a' && smb<='z') return 1;
  44. if (smb>='А') return 1;
  45. if (smb=='Ё' || smb=='ё') return 1;
  46. return 0;
  47. }
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement