Advertisement
OnyRoman

Untitled

Mar 13th, 2021
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int find(char s[], int & i) {
  6. bool ok = true;
  7. while (i < strlen(s) && s[i] != ' ')
  8. if (s[i++] == '.')
  9. ok = false;
  10.  
  11. return ok;
  12. }
  13.  
  14. int main() {
  15. char s[101], cifre[] = "0123456789";
  16. cin.getline(s, 101);
  17.  
  18. for (int i = 0; i < strlen(s); i++) {
  19. if (!strchr(cifre, s[i]))
  20. cout << s[i];
  21. else {
  22. int j = i;
  23. bool ok = find(s, i);
  24. if (ok) {
  25. i = j;
  26. while (s[i] != ' ' && i < strlen(s))
  27. cout << s[i++];
  28. i--;
  29. }
  30. else
  31. i--;
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement