Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main()
  5. {
  6. setlocale(LC_ALL, "ru");
  7.  
  8. int k = 0;
  9. char res[255]{};
  10. char str[255]="h2h5h1h6k7;3m/2;6[/2[51]]5";
  11.  
  12. cout << "вот ваша строка:\n"<<str << endl;
  13.  
  14.  
  15.  
  16. for (int i = 0; i < strlen(str); i++)
  17. {
  18. if (47 < (int)str[i] && (int)str[i] < 58)
  19. {
  20. res[k] = str[i];
  21. res[k + 1] = '\0';
  22. k++;
  23. }
  24. }
  25. cout << "готово: "<<res << endl;
  26.  
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement