daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Aug 17th, 2018 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int st[1001],negativ,nr,ny,n,i,vf;
  4.    char semn[14];
  5.     char numere[]= {'0','1','2','3','4','5','6','7','8','9'};
  6. int main()
  7. {
  8.     cin>>n;
  9.     for(i=1;i<=n+1;i++)
  10.     {
  11.         negativ=0;
  12.         cin.getline(semn,14);
  13.         if(semn[0]=='p'&&semn[1]=='u')
  14.         {  nr=0;
  15.             vf++;
  16.             if(semn[5]=='-')
  17.                 negativ=1;
  18.             if(negativ==1)
  19.                 ny=6;
  20.             else
  21.                 ny=5;
  22.             while(semn[ny]<=numere[8]&&semn[ny]>=numere[0])
  23.             {
  24.                 nr=nr*10+(semn[ny]-48);
  25.                 ny++;
  26.             }
  27.             if(negativ==1)
  28.                 nr=-nr;
  29.             st[vf]=nr;
  30.         }
  31.         if(semn[0]=='p'&&semn[1]=='o'&&vf!=0)
  32.             vf--;
  33.         if(semn[0]=='t'&&vf!=0)
  34.             cout<<st[vf]<<endl;
  35.     }
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top