标题: 救命啊!C programing-LINKED LIST! [打印本页] 作者: 凯茹 时间: 2009-7-26 04:02 PM 标题: 救命啊!C programing-LINKED LIST! 谢谢各位上次帮我解决assessment1的问题。。。
现在希望大家能帮我这更难的assessment2啊,快疯了!
1.Write a C program to read a list of books from a file and create a linked list to store them. The purpose of this program is to keep track of the books kept in a shelf. The shelf is a three-tier shelf and each tier can store up to 4500 pages maximum. The books are kept in alphabetical order (ascending).
Your program should provide the following functions:-
a. Print the detail of all books.
b. Insert new book to the shelf in alphabetical order. However, if the first-tier is full, you must put the book into the second tier.
c. Remove a book from the list.
d. Search for a book using the book title, return the tier where the book is placed.
e. Generate warning if the shelf is 75% full.
f. Store all the books information back into a file for future use.
int choice;
do{
printf("*************************\n");
printf("*\tMAIN MENU\t*\n");
printf("*************************\n");
printf("1.Insert a new book.\n");
printf("2.Remove a book.\n");
printf("3.Search for a book.\n");
printf("4.List all the books.\n");
printf("5.Exit the process.\n");
do{
printf("Enter your choice : ");
scanf("%d",&choice);
switch(choice){
case 1:
printf("Enter the book name : ");
scanf("%c",&Name);
printf("Enter the author name of the book : ");
fflush(stdin);
scanf("%c",&Author);
printf("Enter the pages of the book : ");
scanf("%d",&Pages);
bList = Insert_Book(bList,bPre,bCur,Name,Author,Pages);
bCur = bList;
while(bCur!=NULL){
printf("%c %c %d\n",bCur->data,bCur->data1,bCur->data2);
bCur = bCur->link;
}system("PAUSE");
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
system("cls");
printf("\nThank you\n");
system("PAUSE");
break;
default:
printf("\n\n\n>>>>>you must type in 1,2,3,4,or 5!<<<<<\n\n\n");
system("PAUSE");
break;
}
}while(choice != 1 && 2 && choice != 3 && choice != 4 && choice != 5);
}while(choice != 5);
}
请帮帮我。。。
这是我的probem statement.
1.我要怎样将我所key in 的book name,author 换成string由function放进main里的case 1(Insert function)。
资料:Book Name ---string ; Author ---string ; Page ---int.