Current location - Training Enrollment Network - Books and materials - ! ! ! C language problems, solve homework! ! ! ! ! ! ! Seek an answer
! ! ! C language problems, solve homework! ! ! ! ! ! ! Seek an answer
Many questions, such as book information, include

Book number, title, publishing house, publication time, whether it has been read.

The structure of five messages, yours has only two. There are procedures, and there are some problems in other places. I suggest you start with a simple procedure. If it is homework, you can refer to what others wrote.

# include & ltstdio.h & gt

# include & ltstring.h & gt

# Define N 5

Typedef structure {

Character [20];

char Name[20];

Char publishing [20];

char Date[20];

State of charge;

} book;

Books [n+1];

int main()

{

int I;

char s[20];

Printf ("Please build an information base, * * * five books. \nEnter the book number, title, publisher, publication time and whether it has been read (y/n) \ n ");

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

Get (book[i]. No);

Get (book[i]. name);

Obtain (book[i]. publish);

Get (book[i]. date);

Scanf("%c ",& Book [me]. Status);

}

///printf("%c ",book[0]。 Status);

Printf ("Database establishment! \ nPlease enter a title to borrow: ");

Obtain;

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

if(strcmp(s,book[i])。 name)= = 0)break;

If(i==N) printf ("no book \ n");

Else if (book [i]. State == 'N') {

Printf ("success");

Book [me]. State = ' Y

}

Else printf ("It has been lent, and cannot be lent \ n");

Returns 0;

}

/*

00000 1

English

People education

1995/0 1/0 1

Y

*/