Current location - Music Encyclopedia - Dating - Qingdao switch makes friends.
Qingdao switch makes friends.
# include & ltstdio.h & gt

Structural car

{

char a[ 10];

char b[20];

} car 1[ 100];

Master ()

{

FILE * fp

char ch[ 10]; //Play the entered license plate.

int I;

If((fp=fopen ("your data file ","rt ")= = NULL)// These lines are to quit the program and not open the file.

{//That's how the standard is written.

Printf ("Unable to open file");

Exit (1);

}

for(I = 0; I< 100; i++)

Car[i]=fscanf(fp, "%s %s", a, b) // Read the data into the car array.

Printf ("input license plate");

gets(ch);

for(I = 0; I< 100; i++)

if(strcmp(car[I]-& gt; a,ch))

puts(car[I]-& gt; b);

fclose(FP);

}

The idea is basically this. I have forgotten many things. You should be able to change this program by carefully observing the reading, writing and structure of the file.