Solved

stack input & output

Posted on 2000-03-28
2
274 Views
Last Modified: 2010-04-16
I want A program As Aunit To Input In Stack And Output Of it And And I want This Code To Help At Some Algorithms
0
Comment
Question by:hassan_ahmed
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
amgedeldirdiri earned 75 total points
ID: 2664553
{You Can Use This Code To Do What Do You Want By Stack And This is Simple Code To Show How You Can Made Stack }
Unit Stack;
Interface
Uses Crt;
Const
Max=50;
Buttomstack=0;
Type
   TStack=Record
    Item:Array[1..Max]Of Char;
    Top:Buttomstack..Max;
   End;
   RStack=Record
    Item:Array[1..Max]Of Real;
    Top:Buttomstack..Max;
    End;
Procedure MakStackEmpty(Var S:TStack);
Function Empty(S:TStack):Boolean;
Function Full(S:TStack):Boolean;
Function Pop(Var S:TStack):Char;
Procedure Push(Var S:TStack; X:Char);
Procedure MakRStackEmpty(Var S:RStack);
Function REmpty(S:RStack):Boolean;
Function RFull(S:RStack):Boolean;
Function RPop(Var S:RStack):Real;
Procedure RPush(Var S:RStack; X:Real);
Implementation
Procedure MakStackEmpty(Var S:TStack);
Begin
   S.Top:=ButtomStack;
end;
Function Empty(S:TStack):Boolean;
Begin
  Empty:=S.Top=ButtomStack;
End;

Function Full(S:TStack):Boolean;
Begin
  Full:=S.Top=Max;
End;
Function Pop(Var S:TStack):Char;
Begin
   If Empty(S) Then
     Writeln('Stack Is Under Flow')
   Else
   Begin
     Pop:=S.Item[S.Top];
     S.Top:=S.Top-1;
   End;
End;
Procedure Push(Var S:TStack; X:Char);
Begin
   If Full(S) Then
    Writeln('Stack Is Overflow')
   Else
   Begin
     S.Top:=S.Top+1;
     S.Item[S.Top]:=X;
   End;
End;
Procedure MakRStackEmpty(Var S:RStack);
Begin
   S.Top:=ButtomStack;
end;
Function REmpty(S:RStack):Boolean;
Begin
  REmpty:=S.Top=ButtomStack;
End;
Function RFull(S:RStack):Boolean;
Begin
  RFull:=S.Top=Max;
End;
Function RPop(Var S:RStack):Real;
Begin
   If REmpty(S) Then
     Writeln('Stack Is Under Flow')
   Else
   Begin
     RPop:=S.Item[S.Top];
     S.Top:=S.Top-1;
   End;
End;
Procedure RPush(Var S:RStack; X:Real);
Begin
   If RFull(S) Then
    Writeln('Stack Is Overflow')
   Else
   Begin
     S.Top:=S.Top+1;
     S.Item[S.Top]:=X;
   End;
End;
End.

0
 

Author Comment

by:hassan_ahmed
ID: 2664584
thank you for your code and i will get it to do my work that i have
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi & Indy 10 Whois over Web Proxy 3 1,233
Setting up Idhttp indy component to use a proxy server 2 1,707
delphi 8 625
Android Application not running 1 500
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
Invest in your employees with these five simple steps to improve employee engagement and retention.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question