diff --git a/C/Double_linklist.c b/C/Double_linklist.c new file mode 100644 index 0000000..ea42fbf --- /dev/null +++ b/C/Double_linklist.c @@ -0,0 +1,193 @@ + +#include +#include +#include +struct student_record +{ + + char clas[50]; + char name[50]; + char email[50]; + char contact[50]; + char prn[50]; + int rollno; + struct student_record *next; + struct student_record *prev; + + +}student_record; +struct student_record *head; +void insert_data(int n) +{ int i; + struct student_record *temp = (struct student_record *)malloc(sizeof(struct student_record)); + printf("Enter the Name Of Student \n"); + scanf("%s",&temp->name); + printf("Enter the Class Of Student \n"); + scanf("%s",&temp->clas); + printf("Enter the Contact No. Of Student \n"); + scanf("%s",&temp->contact); + printf("Enter the Email-ID Of Student \n"); + scanf("%s",&temp->email); + printf("Enter the PRN Of Student \n"); + scanf("%s",&temp->prn); + printf("Enter the Roll No. Of Student \n"); + scanf("%d",&temp->rollno); + + + + temp->next=NULL; + temp->prev=NULL; + if(n==1) + { + if(head!=NULL) + { + temp->next = head; + head->prev = temp; + } + head = temp; + return; + } + + struct Node *temp1 = head; + for(i=0;inext; //n+1 node + //nth node + temp->prev = temp1; + temp->next = temp1->next; + temp1->next->prev = temp; + temp1->next = temp; +} + +void disp() +{ + struct student_record *temp = head; + while(temp!=NULL) + { + printf("Name: %s \n",temp->name); + printf("Roll No is: %d \n",temp->rollno); + printf("PRN: %s \n",temp->prn); + printf("Email-ID: %s \n",temp->email); + printf("Class: %s \n",temp->clas); + printf("Contact: %s \n",temp->contact); + temp = temp->next; + } + printf("\n"); +} +void del(int x) +{ +struct student_record *temp3 = head; + if(x==1) + { + head = temp3->next; + free(temp3); + } + + int i; + for(int i=0;inext; + struct student_record *temp4 = temp3->next; + temp3->next = temp4->next; + free(temp3); +} + + + +void search(char ni[5]) +{ + int flag=0; + struct student_record *temp = head; + while(temp!=NULL) + { + if(strcmp(temp->name,ni)==0) + { + flag=1; + printf("\n\nName of Student : %s ",temp->name); + printf("\n\nPRN of Student : %s ",temp->prn); + printf("\n\nRoll No. of Student : %d",temp->rollno); + printf("\n\nContact No. of Student : %s",temp->contact); + printf("\n\n\n"); + } + temp=temp->next; + } + if(flag==0) + printf("\n\nNo Match Found."); +} +void modify(int rn) +{ + struct student_record *temp = head; + int ch; + while(temp->rollno!=rn && temp!=NULL) + temp=temp->next; + if(temp->rollno==rn) + { + printf("******* MODIFY *******\n1.Name\n2.PRN"); + printf("\n3.Contact No\nEnter choice: "); + scanf("%d",&ch); + switch(ch) + { + case 1 : printf("Enter the Name of Student : "); + scanf("%s",&temp->name);break; + case 2 : printf("\nEnter the PRN of Student : "); + scanf("%s",&temp->prn);break; + case 3 : printf("\nEnter the Contact No. of Student : "); + scanf("%s",&temp->contact);break; + + } + } + else + printf("\nRecord not Found."); +} + +int main() +{ + int ch,p,a,rn; + char ni[5]; + while(ch!=6) + { + printf("1.Add the Record.\n\n2.Delete Record."); + printf("\n\n3.Display\n\n4.Search\n\n5.Modify\n\n6.Exit"); + printf("\n\nEnter the Choice: "); + scanf("%d",&ch); + switch(ch) + { + case 1: + printf("enter the position"); + scanf("%d",&p); + insert_data(p); + break; + + case 2: + printf("enter the pos from where you want to delete"); + scanf("%d",&a); + del(a); + break; + + case 3: + disp(); + break; + + case 4: + printf("Enter the Name : "); + scanf("%s",&ni); + search(ni); + break; + case 5: + printf("Enter the Roll No : "); + scanf("%d",&rn); + modify(rn); + break; + + + default: + printf("wrong choice"); + break; + } + } + + + return 0; +} + + + + diff --git a/C/Single_linked_list.c b/C/Single_linked_list.c new file mode 100644 index 0000000..72fd550 --- /dev/null +++ b/C/Single_linked_list.c @@ -0,0 +1,37 @@ +#include +#include +#include +struct node +{ + int data; + struct node *link; +} *head,*p,*x; + +void main() +{ + int d; + char c; + clrscr(); + head=(struct node*)malloc(sizeof(struct node)); + head->link= NULL; + p=head; + do + { + printf("data: "); + scanf("%d",&d); + x=(struct node*)malloc(sizeof(struct node)); + x->data=d; + x->link=p->link; + p->link=x; + p=x; + printf("continue?"); + scanf(" %c",&c); + }while(c!='n'); + p=head->link; + while(p!= NULL) + { + printf("\n %d",p->data); + p=p->link; + } + getch(); +} diff --git a/C/circularLinkList.c b/C/circularLinkList.c new file mode 100644 index 0000000..f262ac4 --- /dev/null +++ b/C/circularLinkList.c @@ -0,0 +1,89 @@ +#include +#include +#include + +struct Node{ + int data; + struct Node *next; +}*last=NULL,*head=NULL; + +typedef struct Node node; + +node circ_ll(){ + node *NN; + NN=(node *)malloc(sizeof(node)); + printf("Enter Data:"); + int data; + scanf("%d",&data); + NN->data=data; + node *cptr=head; + if(head==NULL) + { + NN->next=NN; + head=NN; + last=NN; + printf("It begins at start.\n"); + } + else if(head==last) + { + NN->next=head; + cptr->next=NN; + last=NN; + printf("Two node.\n"); + } + else + { + while(cptr!=last) + { + cptr=cptr->next; + } + NN->next=head; + cptr->next=NN; + last=NN; + printf("Nodes attached at end.\n"); + } +} + +node display(){ + system("CLS"); + printf("last->"); + node *cptr; + cptr=head; + if(cptr==last && cptr!=NULL) + printf("%d->",cptr->data); + else if(head==NULL) + ; + else + { + while(cptr!=last) + { + printf("%d->",cptr->data); + cptr=cptr->next; + } + printf("%d->",cptr->data); + } + printf("last\n"); +} + +int main() +{ + display(); + Other: + printf("Circular Linked List-\n \ + 1. To add a node.\n \ + 2. display \n\ + Enter Choice:"); + int choice; + scanf("%d",&choice); + if(choice==1) + circ_ll(); + if(choice==2) + display(); + printf("Another Operation:\n \ + 1 for yes. \n \ + 0 for exit.\n"); + int option; + scanf("%d",&option); + if(option==1) + goto Other; +} diff --git a/README.md b/README.md index 6d9f8be..dde32ee 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # HacktoberFest-2019 Welcome to HacktoberFest 2019! -Follow these steps to make your first pull request- +Please Follow these steps to make your first pull request- Fork this repository. @@ -11,9 +11,9 @@ Follow these steps to make your first pull request- Write these command on your terminal- - git add -A + git add -abhishekmankuskar - git commit -m "your name" + git commit -m "Abhishek Mankusar" git push origin master @@ -27,6 +27,6 @@ Then create your pull request. Congratulations!! You have successfully created your pull request. -Check your progress here (https://hacktoberfest.digitalocean.com/profile) + Wait for your shirt.. Enjoy Coding.. Visit my reposities for furthur help diff --git a/index.html b/index.html index 256cbc4..a1a6367 100644 --- a/index.html +++ b/index.html @@ -1,56 +1,77 @@ - - - + + - -
. - -
- +
. + +

Hacktober Fest Contributors

-
+
- +