Advertisement
stiansjogren

Untitled

Oct 10th, 2014
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <sstream>
  4. #include <cstdlib>
  5. #include "ctype.h"
  6. using namespace std;
  7. void *sorter(std::vector<char>numb, std::vector<char>letr);
  8. bool isChar(char a);
  9.  
  10. int main() {
  11.  
  12. std::vector<char>letr;
  13. std::vector<int> numb;
  14. std::stringstream ss;
  15. std::string s;
  16. bool l =0;
  17. char b;
  18. int cnt=0;
  19. while (getline(cin,s)){
  20. std::stringstream ss(s);
  21. char a;
  22. while(ss >> a){
  23.  
  24. if(isalpha(a)==1024){
  25. letr.push_back(a);
  26. l=1;
  27. b=a;
  28. }
  29. else if (isdigit(a)==1){
  30. numb.push_back(a);
  31. letr.push_back(b);
  32. }
  33. else{
  34. //cout << a << endl;
  35.  
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42. }
  43. cout << endl;
  44. }
  45.  
  46. for( std::vector<char>::iterator i = letr.begin(); i != letr.end(); ++i){
  47. std::cout << *i << ' ';
  48. }
  49.  
  50. for (int k=0;k!=numb.size();k++){
  51. numb[k]= numb[k]-48;
  52.  
  53. }
  54.  
  55. for(std::vector <int>::iterator j=numb.begin(); j!= numb.end();j++){
  56. std::cout << *j << ' ';
  57. }
  58.  
  59. return 0;
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement