Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Laba_4.3_IX.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <stack>
- using namespace std;
- int main()
- {
- char simv[10000];
- stack <char> ch, ost;
- int k,i;
- cin>>k;
- for(i=0;i<k;i++)
- {
- cin>>simv[i];
- 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'))
- ch.push(simv[i]);
- else
- ost.push(simv[i]);
- }
- cout<<endl<<"Chisla: ";
- while(ch.size()!=0)
- {
- cout<<ch.top()<<" "; ch.pop();
- }
- cout<<endl<<"Ostalnoe: ";
- while(ost.size()!=0)
- {
- cout<<ost.top()<<" "; ost.pop();
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment