Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The elements in the sequence table are plastic.
The elements in the sequence table are plastic.
# include & ltstdio.h & gt

# include & ltstdlib.h & gt

# Define maxsize 100

Typedef structure

{

int * elem

Int length;

} sqllist

void deletenumber(sqllist *A,int x,int k)

{

int i,j;

If (k! = A-& gt; Length)

{

for(I = 0; I & lta-& gt;; Length; i++)

{

if(*(A-& gt; elem+i)==x)

{

for(j = I; j & lta-& gt; Length-1; j++)

{

*(A->; elem+j)= *(A->; elem+j+ 1);

}

a-& gt; Length-;

k = I;

Break;

}

}

deletenumber(A,x,k);

}

}

void init(sqllist *A)

{

int I;

int n;

a-& gt; elem =(int *)malloc(sizeof(int)* maxsize);

Printf ("Please enter an integer n \ n");

scanf("%d ",& ampn);

a-& gt; Length = n;;

for(I = 0; I & ltn;; i++)

{

Printf ("Please enter %d integers \n", i+1);

scanf("%d ",A-& gt; elem+I);

}

}

Void output (sqllist *A)

{

int I;

Printf ("The value in the sequence table is: \ n");

for(I = 0; I & lta-& gt;; Length; i++)

printf(" % d " ,*(A-& gt; elem+I));

printf(" \ n ");

}

void main()

{

sqllist * A;

int x;

a =(SQL list *)malloc(sizeof(SQL list));

init(A);

Output (a);

Printf ("Please enter the value x \ n "); to be deleted);

scanf("%d ",& ampx);

deletenumber(A,x, 1);

Output (a);

}