Station management system --- automatic fee calculation

Source: Internet
Author: User
Tags define null


# Include "stdio. h"
# Include "string. h"
# Include "stdlib. h"
# Include "time. h"
# Define null 0
# Define Maxsize 4

Void clear (char a [])

{
Int I, counta;
Counta = strlen ();
For (I = 0; I <counta; I ++)
A [I] = '';
}

Struct car // define the car's struct
{
Char message [10];
Char num [10];
Char intime [10];
Char outtime [10];
Int expense;
Int delay;
Int position;
};


Typedef struct //************************************ *********************************
{
Struct car d [Maxsize];
Int top;
} SeqStack;

Void init (SeqStack * s) // initialize the stack
{
S-> top =-1;
}

Int isemptystack (SeqStack * s) // checks whether the stack is empty.
{
If (s-> top =-1)
Return 1;
Else
Return 0;
}

Int isfullstack (SeqStack * s) // determines whether the stack is full.
{
If (s-> top = Maxsize-1)
Return 1;
Else
Return 0;
}

Void push (SeqStack * s, struct car x) // stack entry
{
If (! Isfullstack (s ))
{
S-> top ++;
S-> d [s-> top] = x;
}
}

Struct car pop (SeqStack * s) //, take the top element of the stack and exit the stack
{
Car x;
If (s-> top! =-1)
{
X = s-> d [s-> top];
S-> top --;
Return x;
}

}


Car gettop (SeqStack * s) // gets the top element of the stack.
{
Car x;
If (s-> top! =-1)
{
X = s-> d [s-> top];
Return x;
}
 
}
//************************************** **************************** *********


//************************************** * *** Queue linked list *********************************** ***

Typedef struct slnode // defines the contact nature of the chain queue
{
Struct car data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.