?
Solved

stack input & output

Posted on 2000-03-28
2
Medium Priority
?
282 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 300 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
I originally wrote this article to compare SARDU and YUMI, but have now added Easy2Boot, since that is the one I currently use and find the easiest to create and alter.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

765 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