Вы находитесь на странице: 1из 39

Lovely institute of engineering and Computer application b.tech-m.

tech(dual degree)- cse mini project onimplementation of doubly linked list using graphics

submitted t0miss deepika sukhija rk2r13a15

submitted byAJAY KUMAR roll n0-

regn no11009446 Acknowledgment


I have created and nurtured this project for last two months. The resources like internet, books have contributed in materializing this project. This project bears an imprint of many people. I acknowledge the magnanimous support and guidance of these resources in carrying out this project work. I also wish to express heartfelt gratitude to my mam and my friends who have rendered their generous assistance. It would be injustice if I dont thank my friends who helped me during this project.

Contents1. Introduction of link list 2. Doubly link list 3. Functions of graphics a) getcolor function b) cleardevice function c) getmaxcolor function d) getmaxy function e) setcolor function f) putpixel function g) Source code

4. references

Link listIn computer science, a linked list is a data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is composed of a datum and a reference (in other words, a link) to the next node in the sequence; more complex variants add additional links. This structure allows for efficient insertion or removal of elements from any position in the sequence.

Doubly link listIn computer science, a doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains two fields, called links, that are references to the previous and to the next node in the sequence of nodes. The beginning and ending nodes' previous and next links, respectively, point to some kind of terminator, typically a sentinel node or null, to facilitate traversal of the list. If there is only one sentinel node, then the list is circularly linked via the sentinel node. It can be conceptualized as two singly linked lists formed from the same data items, but in opposite sequential orders.

The two node links allow traversal of the list in either direction. While adding or removing a node in a doubly linked list requires changing more links than the same operations on a singly linked list, the operations are simpler and potentially more efficient (for nodes other than first nodes) because there is no need to keep track of the previous node during traversal or no need to traverse the list to find the previous node, so that its link can be modified. Now we have to implement the doubly linked list using graphics but firstly I would like to explain about graphics and some of the graphics functions.

Functions of graphicsC graphics using graphics.h functions or WinBGIM (Windows 7 ) can be used to draw different shapes, display text in different fonts, change color and many more. Using functions of graphics.h in turbo c compiler you can make graphics programs, animations, projects and games.You can draw circles, lines, rectangles, bars and many other geometrical figures. You can change their colors using the available functions and fill them. Following is a list of functions of graphics.h header file. Every function is discussed with the arguments it needs, its description, possible errors while using that function and a sample c graphics program with its output.

SOME of c graphics functionsgetcolor functiongetcolor function returns the current drawing color. Declaration : int getcolor( ); e.g. a = getcolor( ); // a is an integer variable if current drawing color is WHITE then a will be 15.

Cleardevice function-

Declaration :- void cleardevice(); cleardevice function clears the screen in graphics mode and sets the current position to (0,0). Clearing the screen consists of filling the screen with current background color.

Getmaxcolor functiongetmaxcolor function returns maximum color value for current graphics mode and driver. Total number of colors available for current graphics mode and driver are ( getmaxcolor() + 1 ) as color numbering starts from zero. Declaration :- int getmaxcolor( );

Getmaxy function
getmaxy function returns the maximum Y coordinate for current graphics mode and driver. Declaration :- int getmaxy();

Setcolor functionDeclaration :- void setcolor(int color); In Turbo Graphics each color is assigned a number. Total 16 colors are available. Strictly speaking number of available colors depends on current graphics mode and driver.For Example :- BLACK is assigned 0, RED is assigned 4 etc. setcolor function is used to change the current drawing color.e.g. setcolor(RED) or setcolor(4) changes the current drawing color to RED. Remember that default drawing color is WHITE.

Putpixel functionputpixel function plots a pixel at location (x, y) of specified color. Declaration :- void putpixel(int x, int y, int color);

For example if we want to draw a GREEN color pixel at (35, 45) then we will write putpixel(35, 35, GREEN); in our c program, putpixel function can be used to draw circles, lines and ellipses using various algorithms.

Source codeThis program maintains a employees record using doubly linked list. It involves simple graphics and a login me nu where I had used file hadling to maintain a record og 3 users name and their password . so before running the program kindly create a text document in d:\with the name LOGIN.txt.In this just add the following data: Ceo computer Manager mouse Admin hello123 i.e only 3 persons can be allowed to login with their respective password PROGRAM#include<dos.h> #include<string.h> #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> #include<alloc.h> struct login /* Used for records of authorised login */

{ char username[30]; char password[15];

}; struct login l[3];/* as authorised users are ceo,manager and administrator */

struct employee { /* structure of Double linked list */

int employee_no; char employee_name[20]; float grosspay; char designation[10]; int age; char sex[6]; struct employee *nextptr; struct employee *previousptr; };

typedef struct employee employee; /*********************************FUNCTION PROTOTYPE***************************/ void border_margin(void); void printmain(void); void new_employee(); void display(employee *); void delete_employee(); void update(); /* /* CREATING BORDER */ */ */ */ */

PRINTING MAIN

/* APPEND FUNCTIONS /* PRINTING THE RECORDS /* DELETING THE RECORDS */ */

/* TO MODIFY FUNCTION

void search_employee(int); /* SEARCHING RECORDS void printdetail(void); employee *getnode(int);

/* FOR CREATING NEW NODES (MALLOC) */

employee *head=NULL; employee *tail=NULL;

/* INITIALLY LINKED LIST IS EMPTY */

/******************************************************************************/

int k,i,j,count=0; char ans,choice,choice1,choice2,choice3; /* for accessing menu */ void main() { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int maxx, maxy,i,count=0,flag=0; /* initialize graphics, local variables */ initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

/* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* If an error occurred as grOK means no error */ { clrscr(); printf("Graphics Error Detected : %s\n", grapherrormsg(errorcode)); printf("Press any key to halt...."); printf("\nThank You.\t\n- Comp. Science Students.\n Batch : C-5 and C6"); printf("\n Jaypee University Of Information Technology , Waknaghat"); getch(); exit(0); /* Terminate with an error code */ }

maxx = getmaxx(); maxy = getmaxy(); setcolor(YELLOW); /* select drawing color select fill color */ */

setfillstyle(SOLID_FILL,BLUE); /*

rectangle(0, 0, maxx, maxy); /* draw a border around the screen */ bar(0,0,maxx,maxy); settextstyle(5,0,6); outtextxy(130,50,"Employee Records"); outtextxy(250,130,"Of A"); outtextxy(210,210,"Company"); settextstyle(2,0,7); outtextxy(120,300,"A DOUBLY LINKED LIST IMPLEMENTATION"); settextstyle(2,0,4); outtextxy(100,360,"PRESS A KEY TO CONTINUE ...."); music(3); /********************** END OF INTRO SCREEN **************************************/ /* for painting background blue */

cleardevice(); /* CLEARS THE SCREEN */ settextstyle(0,0,0); setfillstyle(SOLID_FILL,BLUE); /* select fill color */

rectangle(0, 0, maxx, maxy); /* draw a border around the screen */ bar(0,0,maxx,maxy); setcolor(YELLOW); outtextxy(25,30,"");outtextxy(30,30,""); outtextxy(30,25,""); for(i=35;i<=450;i+=5) /* for painting background blue */

outtextxy(30,i,""); for(i=35;i<=600;i+=5) outtextxy(i,30,""); settextstyle(5,0,5);outtextxy(90,50,"About the Project"); char str1[70]={"Programmers : Students Of Batch C5 & C6"}; char str2[30]={"Platform : Turbo C++ IDE"};

char str3[30]={"Duration : Approx 10 Days"}; char str4[34]={"Instructor : Mr.Satish Chandra"}; char str5[30]={"Contacts : +919816184767"}; char str6[30]={" Press A Key To Continue "}; int j=10,k=12; settextstyle(0,0,0);

// LOGIN MENU cleardevice(); logi: /* label to return in case access is denied */ setfillstyle(SOLID_FILL,BLUE); /* select fill color */

rectangle(0, 0, maxx, maxy); /* draw a border around the screen */ bar(0,0,maxx,maxy); settextstyle(5,0,5); setcolor(YELLOW); outtextxy(110,90," Login Menu "); settextstyle(0,0,0); k = 155; outtextxy(150,220,""); for(i=0;i<=1050;i+=4) /* for painting background blue */

{ outtextxy(k,220,""); k++; } outtextxy(424,220,"");outtextxy(150,225,""); outtextxy(150,230,"");outtextxy(150,235,""); outtextxy(150,240,"");outtextxy(150,245,""); outtextxy(424,225,"");outtextxy(424,230,""); outtextxy(424,235,"");outtextxy(424,240,""); outtextxy(424,245,"");outtextxy(150,250,""); outtextxy(150,255,"");outtextxy(150,260,""); outtextxy(150,265,"");outtextxy(424,250,""); outtextxy(424,255,"");outtextxy(424,260,""); outtextxy(424,265,"");outtextxy(160,235,"USERNAME : "); outtextxy(160,255,"PASSWORD : "); k=155; char str7[15],str8[10],character; for(i=0;i<=1050;i+=4) { outtextxy(k,245,""); k++; } k=155; for(i=0;i<=1050;i+=4) { outtextxy(k,265,""); k++; } gotoxy(31,15);gets(str7);

i=0;k=31; do { character=getch(); /* These thing is done so that password is not visible*/ gotoxy(k,17) ;printf("*"); str8[i]=character; k++; i++; }while(character != '.'); i--; str8[i]='\0'; /* NOW COMING THE FILE HANDLING */ FILE *fp; i=0;flag=0; fp=fopen("d:\LOGIN.txt","r+");/* login.txt already contains the username n paswd*/ while(fscanf(fp,"%s\t%s\n",l[i].username,l[i].password)!= EOF) { if(strcmp(str7,l[i].username)==0 && strcmp(str8,l[i].password)==0) { flag=1; } i++; } settextstyle(10,0,1); if(flag==0) { outtextxy(140,275," ACCESS DENIED ");music(1);music(1); outtextxy(140,320,"PRESS A KEY TO CONTINUE..."); getch();

count++; if(count< 3) { goto logi; /* i m giving 3 chances in case user make any mistakes */ } else exit(0);/* go out of program as access is denied */ } else { outtextxy(140,275,"ACCESS GRANTED ");music(1);music(1); outtextxy(140,320,"PRESS A KEY TO CONTINUE..."); } fclose(fp); getch(); closegraph(); restorecrtmode();

/********************************************************************************** Now coming to main menu if access granted */

int key; main: printmain(); /* WILL PRINT THE MAIN MENU */ gotoxy(45,21);choice=getche(); switch(choice) { case '1':

new_employee(); /* APPENDING THE RECORD */ getch(); goto main;

case '2': clrscr(); display(head); goto main; case '3': delete_employee(); goto main; /* PRINTING THE RECORDS */

case '4': update(); /* MODIFYING THE RECORDS */ goto main;

case '5': clrscr(); border_margin(); gotoxy(25,6);cprintf("R E C O R D S E A R C H"); gotoxy(5,8);cprintf("ENTER THE EMPLOYEE NUMBER WHICH IS TO BE UPDATED : "); gotoxy(57,8);scanf("%d",&key); search_employee(key); getch(); goto main;

case '6': border_margin(); gotoxy(25,11);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,11);cprintf(""); k++; } gotoxy(50,11);cprintf(""); gotoxy(25,12);cprintf(" ");

gotoxy(25,13);cprintf("");gotoxy(50,13);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,13);cprintf(""); k++; } gotoxy(32,9);cprintf("QUITING ...."); k=26; for(i=1;i<=24;i++) { gotoxy(k,12);cprintf("");delay(50); k++; } gotoxy(22,19);textcolor(YELLOW + BLINK); cprintf("PRESS A KEY TO RETURN TO WINDOWS"); gotoxy(30,17);textcolor(YELLOW);cprintf("B Y E B Y E !!");

gotoxy(24,79); getch(); break;

default: goto main;

} }

void new_employee() { clrscr(); border_margin(); employee *emp; textcolor(YELLOW); gotoxy(25,3);cprintf("E N T E R I N G R E C O R D"); printdetail(); if(head==NULL&&tail==NULL) { count++; emp=getnode(count); head=emp; tail=emp; emp->previousptr=NULL; emp->nextptr=NULL; }

else { count++; emp=getnode(count); emp->previousptr=tail; tail->nextptr=emp; emp->nextptr=NULL; tail=emp; }

} void display(employee *temp) { if(head==NULL) /* EMPTY LINKED LIST */ { clrscr(); border_margin(); gotoxy(25,10);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,10);cprintf(""); k++; } gotoxy(50,10);cprintf(""); gotoxy(25,11);cprintf(" NO RECORDS AVAILABLE "); gotoxy(25,12);cprintf("");gotoxy(50,12);cprintf(""); k=26; for(i=1;i<=24;i++)

{ gotoxy(k,12);cprintf(""); k++; } } else { if(temp==head) do { clrscr(); border_margin(); gotoxy(25,5);cprintf("P R I N T I N G R E C O R D"); printdetail(); gotoxy(20,7);cprintf("%d",temp->employee_no); gotoxy(20,9);puts(temp->employee_name); gotoxy(20,11);cprintf("%f",temp->grosspay);fflush(stdin); gotoxy(20,13);puts(temp->designation); gotoxy(20,15);cprintf("%d",temp->age);fflush(stdin); gotoxy(20,17);puts(temp->sex);

gotoxy(25,20);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,20);cprintf(""); k++; } gotoxy(50,20);cprintf(""); gotoxy(25,21);cprintf(" HIT KEY FOR NEXT RECORD");

gotoxy(25,22);cprintf("");gotoxy(50,22);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,22);cprintf(""); k++; } getch(); temp=temp->nextptr;

}while(temp!=NULL); } } void delete_employee() { int key,flag; employee *temp; temp=head; if(head==NULL) /* EMPTY LINKED LIST */ { clrscr(); border_margin(); gotoxy(25,10);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,10);cprintf(""); k++; }

gotoxy(50,10);cprintf(""); gotoxy(25,11);cprintf(" NO RECORDS AVAILABLE "); gotoxy(25,12);cprintf("");gotoxy(50,12);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,12);cprintf(""); k++; } goto last; } else { clrscr(); border_margin(); gotoxy(10,7);cprintf("ENTER THE EMPLOYEE NUMBER YOU WANT TO DELETE : "); gotoxy(55,7);scanf("%d",&key); border_margin(); gotoxy(25,11);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,11);cprintf(""); k++; } gotoxy(50,11);cprintf(""); gotoxy(25,12);cprintf(" ");

gotoxy(25,13);cprintf("");gotoxy(50,13);cprintf(""); k=26;

for(i=1;i<=24;i++) { gotoxy(k,13);cprintf(""); k++; } gotoxy(25,9);cprintf("SEARCHING FOR RECORDS ..."); k=26; for(i=1;i<=24;i++) { gotoxy(k,12);cprintf("");delay(50); k++; } gotoxy(22,19);textcolor(YELLOW); cprintf("PRESS A KEY TO RETURN TO CONTINUE ..."); gotoxy(28,17);cprintf("SEARCHING COMPLETE"); getch();

/* traverse the entire linked list */ while(temp!=NULL) { if(temp->employee_no == key) { flag++; if(temp==head) /* if node is first */ { head=head->nextptr; head->previousptr=NULL; } else { if(temp->nextptr==NULL) /* if node is last */ temp->previousptr->nextptr=NULL;

else { temp->previousptr->nextptr = temp->nextptr; temp->nextptr->previousptr = temp->previousptr; } free(temp); } } temp=temp->nextptr; } } if(flag==0) { clrscr(); border_margin(); gotoxy(25,10);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,10);cprintf(""); k++; } gotoxy(50,10);cprintf(""); gotoxy(25,11);cprintf(" NO RECORDS FOUND ");

gotoxy(25,12);cprintf("");gotoxy(50,12);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,12);cprintf(""); k++;

} getch(); } if(flag==1) { clrscr(); border_margin(); gotoxy(25,10);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,10);cprintf(""); k++; } gotoxy(50,10);cprintf(""); gotoxy(25,11);cprintf(" RECORD DELETED ");

gotoxy(25,12);cprintf("");gotoxy(50,12);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,12);cprintf(""); k++; } getch(); } last: getch(); } void update()

{ int choice; char str[30]; char f; employee *temp; temp=head; if(head==NULL) /* EMPTY LINKED LIST */ { clrscr(); border_margin(); gotoxy(25,10);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,10);cprintf(""); k++; } gotoxy(50,10);cprintf(""); gotoxy(25,11);cprintf(" NO RECORDS AVAILABLE "); gotoxy(25,12);cprintf("");gotoxy(50,12);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,12);cprintf(""); k++; } } else { clrscr(); border_margin();

gotoxy(25,3);cprintf("R E C O R D U P D A T E"); gotoxy(5,5);cprintf("ENTER THE EMPLOYEE NUMBER WHICH IS TO BE UPDATED : "); gotoxy(57,5);scanf("%d",&choice); if(choice > count) { clrscr(); border_margin(); gotoxy(10,10);cprintf("EMPLOYEE NO NOT FOUND"); getch(); goto last; } again: gotoxy(5,10);cprintf("1. NAME ");gotoxy(5,11);cprintf("2. GROSS PAY"); gotoxy(5,12);cprintf("3. DESIGNATION");gotoxy(5,13);cprintf("4. AGE"); gotoxy(5,14);cprintf("5. SEX"); gotoxy(5,16);cprintf("ENTER THE FIELD YOU WANT TO EDIT : "); gotoxy(41,16);fflush(stdin);f=getch(); switch(f) { case '1': fflush(stdin); gotoxy(5,18);cprintf("ENTER NEW NAME : ");gets(str); while(choice!=temp->employee_no) temp=temp->nextptr; clrscr(); printdetail(); gotoxy(20,7);printf("%d",temp->employee_no); strcpy(temp->employee_name,str);

gotoxy(20,9);printf("%s",temp->employee_name); gotoxy(20,11);printf("%f",temp->grosspay); gotoxy(20,13);puts(temp->designation); gotoxy(20,15);printf("%d",temp->age); gotoxy(20,17);puts(temp->sex); break; case '2': float gp; fflush(stdin); gotoxy(20,18);cprintf("ENTER NEW GROSS : ");scanf("%f",&gp); while(choice!=temp->employee_no) temp=temp->nextptr; clrscr(); printdetail(); gotoxy(20,7);printf("%d",temp->employee_no); temp->grosspay = gp; gotoxy(20,9);printf("%s",temp->employee_name); gotoxy(20,11);printf("%f",temp->grosspay); gotoxy(20,13);puts(temp->designation); gotoxy(20,15);printf("%d",temp->age); gotoxy(20,17);puts(temp->sex); break; case '3': fflush(stdin); gotoxy(20,18);cprintf("ENTER NEW DESIGNATION : ");gets(str); while(choice!=temp->employee_no)

temp=temp->nextptr; clrscr(); printdetail(); gotoxy(20,7);printf("%d",temp->employee_no); strcpy(temp->designation,str); gotoxy(20,9);printf("%s",temp->employee_name); gotoxy(20,11);printf("%f",temp->grosspay); gotoxy(20,13);puts(temp->designation); gotoxy(20,15);printf("%d",temp->age); gotoxy(20,17);puts(temp->sex); break; case '4': int gp1; fflush(stdin); gotoxy(20,18);cprintf("ENTER NEW AGE : ");scanf("%d",&gp1); while(choice!=temp->employee_no) temp=temp->nextptr; clrscr(); printdetail(); gotoxy(20,7);printf("%d",temp->employee_no); temp->age = gp1; gotoxy(20,9);printf("%s",temp->employee_name); gotoxy(20,11);printf("%f",temp->grosspay); gotoxy(20,13);puts(temp->designation); gotoxy(20,15);printf("%d",temp->age); gotoxy(20,17);puts(temp->sex);

break; case '5': fflush(stdin); gotoxy(20,18);cprintf("ENTER NEW SEX : ");gets(str); while(choice!=temp->employee_no) temp=temp->nextptr; clrscr(); printdetail(); gotoxy(20,7);printf("%d",temp->employee_no); strcpy(temp->sex,str); gotoxy(20,9);printf("%s",temp->employee_name); gotoxy(20,11);printf("%f",temp->grosspay); gotoxy(20,13);puts(temp->designation); gotoxy(20,15);printf("%d",temp->age); gotoxy(20,17);puts(temp->sex); break; default: goto again; } gotoxy(25,20);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,20);cprintf(""); k++; } gotoxy(50,20);cprintf("");

gotoxy(25,21);cprintf(" RECORD

UPDATED ");

gotoxy(25,22);cprintf("");gotoxy(50,22);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,22);cprintf(""); k++; } } last: getch(); } employee *getnode(int count) { employee *nodeptr; nodeptr=(employee *)malloc(sizeof(employee)); nodeptr->employee_no=count; gotoxy(20,7);printf("%d",nodeptr->employee_no);fflush(stdin); gotoxy(20,9);gets(nodeptr->employee_name); gotoxy(20,11);scanf("%f",&nodeptr->grosspay);fflush(stdin); gotoxy(20,13);gets(nodeptr->designation); gotoxy(20,15);scanf("%d",&nodeptr->age);fflush(stdin); gotoxy(20,17);gets(nodeptr->sex); gotoxy(25,20);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,20);cprintf(""); k++;

} gotoxy(50,20);cprintf(""); gotoxy(25,21);cprintf(" RECORD ENTRY SUCESSFUL "); gotoxy(25,22);cprintf("");gotoxy(50,22);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,22);cprintf(""); k++; } nodeptr->previousptr=NULL; nodeptr->nextptr=NULL; return nodeptr; } void search_employee(int key) { employee *temp; clrscr(); border_margin(); gotoxy(25,11);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,11);cprintf(""); k++; } gotoxy(50,11);cprintf(""); gotoxy(25,12);cprintf(" ");

gotoxy(25,13);cprintf("");gotoxy(50,13);cprintf("");

k=26; for(i=1;i<=24;i++) { gotoxy(k,13);cprintf(""); k++; } gotoxy(32,9);cprintf("SEARCHING..."); k=26; for(i=1;i<=24;i++) { gotoxy(k,12);cprintf("");delay(50); k++; } gotoxy(22,19);textcolor(YELLOW); cprintf("PRESS A KEY TO RETURN TO CONTINUE >>"); gotoxy(28,17);cprintf("SEARCHING COMPLETE"); getch(); temp=head; int flag=0; if(temp==NULL) /* LINKED LIST IS EMPTY */ { clrscr(); border_margin(); gotoxy(25,10);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,10);cprintf(""); k++; }

gotoxy(50,10);cprintf(""); gotoxy(25,11);cprintf(" NO RECORDS AVAILABLE "); gotoxy(25,12);cprintf("");gotoxy(50,12);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,12);cprintf(""); k++; } music(1);music(1); goto last; } while(temp!=NULL) { if(temp->employee_no==key) { flag++; printdetail(); gotoxy(20,7);printf("%d",temp->employee_no); gotoxy(20,9);puts(temp->employee_name); gotoxy(20,11);printf("%f",temp->grosspay); gotoxy(20,13);gets(temp->designation); gotoxy(20,15);printf("%d",temp->age); gotoxy(20,17);puts(temp->sex); gotoxy(25,20);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,20);cprintf(""); k++;

} gotoxy(50,20);cprintf(""); gotoxy(25,21);cprintf(" RECORD FOUND ");

gotoxy(25,22);cprintf("");gotoxy(50,22);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,22);cprintf(""); k++; } music(1);music(1); } temp=temp->nextptr; } if(flag==0) { clrscr(); border_margin(); clrscr(); border_margin(); gotoxy(25,10);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,10);cprintf(""); k++; } gotoxy(50,10);cprintf(""); gotoxy(25,11);cprintf(" RECORDS NOT FOUND ");

gotoxy(25,12);cprintf("");gotoxy(50,12);cprintf(""); k=26; for(i=1;i<=24;i++) { gotoxy(k,12);cprintf(""); k++; } } last: } void border_margin() { clrscr(); textcolor(YELLOW); int i,j=3; gotoxy(2,2);cprintf(""); for(i=0;i<74;i++) { gotoxy(j,2);cprintf(""); j++; } gotoxy(77,2);cprintf(""); j=3; for(i=0;i<20;i++) { gotoxy(2,j) ;cprintf(""); gotoxy(77,j);cprintf(""); j++; } gotoxy(2,23);cprintf("");

j=3; for(i=0;i<74;i++) { gotoxy(j,23);cprintf(""); j++; } gotoxy(77,23);cprintf(""); } void printmain() { int k,i; border_margin(); /* user defined function to draw margin */ textbackground(0); /* sets background none */ textcolor(YELLOW);/* set text color */ textbackground(RED); gotoxy(6,4);cprintf(""); k=7; for(i=1;i<=24;i++) { gotoxy(k,4);cprintf(""); k++; } gotoxy(31,4);cprintf(""); gotoxy(6,5);cprintf(" 1. ADD RECORDS ");

gotoxy(6,6);cprintf("");gotoxy(31,6);cprintf(""); k=7; for(i=1;i<=24;i++) { gotoxy(k,6);cprintf(""); k++;

gotoxy(43,4);cprintf(""); k=44; for(i=1;i<=24;i++) { gotoxy(k,4);cprintf(""); k++; } gotoxy(68,4);cprintf(""); gotoxy(43,5);cprintf(" 2. DISPLAY RECORDS ");

gotoxy(43,6);cprintf("");gotoxy(68,6);cprintf(""); k=44; for(i=1;i<=24;i++) { gotoxy(k,6);cprintf(""); k++; } gotoxy(6,9);cprintf(""); k=7; for(i=1;i<=24;i++) { gotoxy(k,9);cprintf(""); k++; } gotoxy(31,9);cprintf(""); gotoxy(6,10);cprintf(" 3. DELETE RECORDS ");

gotoxy(6,11);cprintf("");gotoxy(31,11);cprintf(""); k=7;

for(i=1;i<=24;i++) { gotoxy(k,11);cprintf(""); k++; }

gotoxy(43,9);cprintf(""); k=44; for(i=1;i<=24;i++) { gotoxy(k,9);cprintf(""); k++; } gotoxy(68,9);cprintf(""); gotoxy(43,10);cprintf(" 4. UPDATE RECORDS ");

gotoxy(43,11);cprintf("");gotoxy(68,11);cprintf(""); k=44; for(i=1;i<=24;i++) { gotoxy(k,11);cprintf(""); k++; } gotoxy(6,14);cprintf(""); k=7; for(i=1;i<=24;i++) { gotoxy(k,14);cprintf(""); k++; } gotoxy(31,14);cprintf("");

gotoxy(6,15);cprintf(" 5. SEARCH FOR RECORDS "); gotoxy(6,16);cprintf("");gotoxy(31,16);cprintf(""); k=7; for(i=1;i<=24;i++) { gotoxy(k,16);cprintf(""); k++; } gotoxy(43,14);cprintf(""); k=44; for(i=1;i<=24;i++) { gotoxy(k,14);cprintf(""); k++; } gotoxy(68,14);cprintf(""); gotoxy(43,15);cprintf(" 6. QUIT ");

gotoxy(43,16);cprintf("");gotoxy(68,16);cprintf(""); k=44; for(i=1;i<=24;i++) { gotoxy(k,16);cprintf(""); k++; } gotoxy(25,21);cprintf("ENTER YOUR CHOICE : "); } void printdetail() { border_margin(); gotoxy(5,7);cprintf("EMPLOYEE NO : ");

gotoxy(20,8);cprintf("____________________________________________"); gotoxy(5,9);cprintf("NAME : ");

gotoxy(20,10);cprintf("____________________________________________"); gotoxy(5,11);cprintf("GROSS PAY : ");

gotoxy(20,12);cprintf("____________________________________________"); gotoxy(5,13);cprintf("DESIGNATION : "); gotoxy(20,14);cprintf("____________________________________________"); gotoxy(5,15);cprintf("AGE : ");

gotoxy(20,16);cprintf("____________________________________________"); gotoxy(5,17);cprintf("SEX : ");

gotoxy(20,18);cprintf("____________________________________________"); }

References1.en.wikipedia.org/wiki/Doubly_linked_list 2. www.iitk.ac.in/esc101/08Jan/lecnotes/lecture35.pdf 3. thecodecracker.com/c-programming/double-linked-list 4. library.maemodocs.nokia.com/.../glib-Doubly-Linked-Lists.html

**********************END******************** **

Вам также может понравиться