Current location - Health Preservation Learning Network - Healthy weight loss - Ask the master to write two programs (data structures) in C language.
Ask the master to write two programs (data structures) in C language.
# contains "stdio.h"

Typedef structure la

{

int * data

int l;

} La

Typedef structure lb

{

int * data

int l;

} Lb

Typedef structure lc

{

int * data

int l;

} Lc

Void first stone flower (La & i, pound & letter of credit and letter of credit. c)

{

int I = 0;

a . data = new int[ 100]; a . l = 0;

b . data = new int[ 100]; b . l = 0;

c . data = new int[ 100]; c . l = 0;

Printf ("Please enter the number of elements in the collection La and the elements:");

scanf("%d ",& ampa . l);

for(I = 0; I & lta.li++)

scanf("%d ",& ampa . data[I]);

Printf ("Please enter the number of elements in the collection Lb and the elements:");

scanf("%d ",& ampb . l);

for(I = 0; I & ltb.li++)

scanf("%d ",& ampb . data[I]);

}

Void Qiu Jie (L.A. & I, GBP&L/C and L/C. c)

{

int i,j;

for(I = 0; I & lta.li++)

c . data[I]= a . data[I];

c . l = a . l;

for(I = 0; I & ltb.li++)

{

for(j = 0; j & lta.lj++)

if(b . data[I]= = a . data[j])break;

if(j & gt; = a . l)c . data[c . l++]= b . data[I];

Otherwise, continue;

}

}

Invalid stone appearance

{

int I;

for(I = 0; I & ltc.li++)

printf("%d ",c . data[I]);

}

void main()

{

la a;

lb b;

LC c;

Primary ten (A, B, C);

Qiu Jie (A, B, C);

Shixian;

}

I haven't sorted the elements in C, so let's see for ourselves!