Advertisement
myname0

практика_очередь_1

Jun 30th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <queue>
  2. #include <string>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     ifstream in ("input.txt");
  10.     ofstream out ("output.txt");
  11.     queue <char> tmp;
  12.     string temp;
  13.     string b;
  14.     getline (in, temp);
  15.     char a;
  16.     for(int i = 0; i < (int) temp.size(); i++)
  17.     {
  18.         a = temp[i];
  19.         if (isdigit(a))
  20.             b += a;
  21.         else tmp.push(a);
  22.     }
  23.     for (int i = 0; i < (int) b.size(); i++)
  24.     {
  25.         a = b[i];
  26.         tmp.push(a);
  27.     }
  28.     while(!tmp.empty())
  29.     {
  30.  
  31.         out << tmp.front();
  32.         tmp.pop();
  33.     }
  34.    
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement