Advertisement
4yVa4oK

Untitled

Feb 24th, 2020
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. using namespace std;
  6.  
  7. int main(int argc, char** argv) {
  8. cout << "Input string" << endl;
  9. //char numbers[10] = {}'1','2','3','4','5','6','7','8','9','0'}
  10. char str[255];
  11. cin.getline(str,255);
  12. int length = strlen(str);
  13. int arr[length];
  14. int j=0;
  15. char temp[1];
  16. for(int i=0;i<length;i++)
  17. {
  18. // if (isdigit((unsigned char)str[i]))
  19. // {
  20. if(!isalpha(str[i])&&(str[i]!=' '))
  21. {
  22. //if(!str[i]))
  23. //{
  24. temp[0] = str[i]-48;
  25. arr[j]=temp[0];
  26. j++;
  27.  
  28. //}
  29.  
  30.  
  31. }
  32. //}
  33. }
  34.  
  35. /*for (int i = 0; i < length; i++) {
  36. for (int j = 0; j < length-1; j++) {
  37. if (arr[j] < arr[j + 1]) {
  38. int temp = arr[j]; // nicaaee aiiieieoaeuio? ia?aiaiio?
  39. arr[j] = arr[j + 1]; // iaiyai ianoaie
  40. arr[j + 1] = temp; // cia?aiey yeaiaioia
  41. }
  42. }
  43. }*/
  44.  
  45. for (int i = 0; i < j; i++) {
  46. cout << arr[i] << " "; // auaiaei yeaiaiou ianneaa
  47. }
  48.  
  49. system("pause");
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement