Quipex icon

Laba_4.3_IX

Quipex | PRO | 10/06/15 09:23:40 PM UTC | 0 ⭐ | 338 👁️ | Never ⏰ | []
C++ |

710 B

|

None

|

0 👍

/

0 👎

// 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;
}

Comments