Computer Science Canada

Help!!!! Linked list ans database

Author:  jermvirus [ Fri Mar 27, 2009 11:32 pm ]
Post subject:  Help!!!! Linked list ans database

hi, i am a high school student in Jamaica and i have an project that i need help with, i want to create a program that can keep a track off all the books in the library and who they a rented to, so far i just created the first page can some on help me. ned to know how to save the books to a Data base and search for them,


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct database{
char name[100];
char author[100];
char rent_date[100];
char return_date[100];
char student_name[100];
int book_id;
int student_id;
int shelf_number;
};
struct database *current;
struct database *temp;
int option;

int main(int argc, char *argv[])
{
char line[20];

printf("press 1 to Add Book\n");
printf("press 2 to Search\n");
printf("press 3 to Rent Book\n");
printf("press 4 to Return Book\n");
printf("press 5 to EXIT\n");
scanf("%d", &option);

if (option == 1)
{
temp = malloc(sizeof(struct database));
gets(line);
printf("Enter Book Name\n");
gets(temp->name);
printf("Enter Book's Author\n");
gets(temp->author);
printf("Enter Rent Date\n");
gets(temp->rent_date);
printf("Expected Return Date\n");
gets(temp->return_date);
printf("Enter Student Name\n");
gets(temp->student_name);

//write code here to write record to file
}

if (option == 2)
{
printf("Search");

}

system("PAUSE");
return 0;
}


: