Solved

stack input & output

Posted on 2000-03-28
2
277 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

Today’s effective marketing is about coming down to the customers’ level and engaging in a whole new way. A text message is one of the most effective and influential ways that you can engage your customers. Here are eight ways that you can utilize t…
Article by: Justin
In light of the WannaCry ransomware attack that affected millions of Windows machines, you might wonder if your Mac needs protecting. Yes, it does and here is how to do it.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

690 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