Quipex

Laba_4.3_IX

Oct 6th, 2015
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. // Laba_4.3_IX.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <stack>
  7. using namespace std;
  8.  
  9.  
  10. int main()
  11. {
  12.     char simv[10000];
  13.     stack <char> ch, ost;
  14.     int k,i;
  15.     cin>>k;
  16.     for(i=0;i<k;i++)
  17.     {
  18.         cin>>simv[i];
  19.         if((simv[i]=='0')||(simv[i]=='1')||(simv[i]=='2')||(simv[i]=='3')||(simv[i]=='4')||(simv[i]=='5')||(simv[i]=='6')||(simv[i]=='7')||(simv[i]=='8')||(simv[i]=='9'))
  20.             ch.push(simv[i]);
  21.         else
  22.             ost.push(simv[i]);
  23.     }
  24.     cout<<endl<<"Chisla: ";
  25.     while(ch.size()!=0)
  26.     {
  27.         cout<<ch.top()<<" "; ch.pop();
  28.     }
  29.     cout<<endl<<"Ostalnoe: ";
  30.     while(ost.size()!=0)
  31.     {
  32.         cout<<ost.top()<<" "; ost.pop();
  33.     }
  34.     system("pause");
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment