Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <cstring>
  2. void Alphanum(char s[], char cuv[][21], int &n, int num[], int &m)
  3. {
  4. int i,h,y,j,ok,k,z,nr,l;
  5. char aux[101],*p;
  6. p=strstr(s," ");
  7. while(p!=NULL)
  8. {
  9. i=p-s;
  10. strcpy(aux,s+i+1);
  11. strcpy(s+i,aux);
  12. }
  13. if(s[0]==' ')
  14. {
  15. strcpy(aux,s+1);
  16. strcpy(s,aux);
  17. }
  18. if(s[strlen(s)-1]==' ')
  19. s[strlen(s)-1]=NULL;
  20. k=-1;
  21. z=-1;
  22. p=strtok(s," ");
  23. while(p!=0)
  24. {
  25. if(p[0]>='0' && p[0]<='9')
  26. {
  27. nr=0;
  28. l=strlen(p)-1;
  29. for(i=0;i<=l;i++)
  30. nr=nr*10+p[i]-'0';
  31. num[++z]=nr;
  32. }
  33. if(p[0]>='a' && p[0]<='z')
  34. {
  35. strcpy(cuv[++k],p);
  36. cout<<cuv[k]<<endl;
  37. }
  38. p=strtok(NULL," ");
  39. }
  40. n=k+1;
  41. m=z+1;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement