From 9c0e771a1b925022358ea10725014fd8a080037f Mon Sep 17 00:00:00 2001 From: bllaaahhhh <41756714+bllaaahhhh@users.noreply.github.com> Date: Sat, 27 Oct 2018 14:28:03 +0530 Subject: [PATCH 1/3] project for an online personal diary just a PR for hacktober fest --- online personal diary.html | 188 +++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 online personal diary.html diff --git a/online personal diary.html b/online personal diary.html new file mode 100644 index 0000000..4ee67b4 --- /dev/null +++ b/online personal diary.html @@ -0,0 +1,188 @@ + + + My personal Diary + + + + + + +

My contacts

+
+

Contacts

+ + Add


+


+ + Done +
+
+
Ambulance
+
108
+ +
Police
+
100
+ +
+ + + + + \ No newline at end of file From 2e3c0dbe7cb220c051d9230ca4dea90f78447d83 Mon Sep 17 00:00:00 2001 From: ishank99 <44545433+ishank99@users.noreply.github.com> Date: Mon, 29 Oct 2018 12:22:32 +0530 Subject: [PATCH 2/3] Stack program For hacktober fest --- main.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 main.c diff --git a/main.c b/main.c new file mode 100644 index 0000000..95f84ca --- /dev/null +++ b/main.c @@ -0,0 +1,107 @@ +#include +#include +#include +void push(); +void pop(); +void print(); +void MultiPush(); +void MultiDelete(); + +int stk[4],n=4,top=-1; +void main() +{ + int ch; + while(1) + { + printf("1.To insert a number \n"); + printf("2.To delete a number \n"); + printf("3.To print stack elements \n"); + printf("4.To insert multiple number \n"); + printf("5.To delete multiple number \n"); + printf("6.Exit \n"); + printf("Enter your choice = "); + scanf("%d",&ch); + switch(ch) + { + case 1: push(); + break; + case 2: pop(); + break; + case 3 : print(); + break; + case 4 : MultiPush(); + break; + case 5 : MultiDelete(); + break; + case 6 : exit(1); + break; + + } +getch(); +system("cls"); + } + +} + +void push() +{ + int item; + printf("Enter the digit \n"); + scanf("%d",&item); + if(top==n-1) + { + printf("Overflow"); + + } + else + { + top=top+1; + stk[top]=item; + } + +} + +void pop() +{ +int temp; + if (top==-1) + { + printf("Underflow"); + } + else + { + temp=stk[top]; + top=top-1; + } +} + +void print() +{ + int i; + for(i=top;i>=0;i--) + { + printf(" stk[%d]= %d \n ",i,stk[i]); + } + +} + +void MultiPush() +{ + int num,i; + printf("Enter the number of elements to be inserted = "); + scanf("%d",&num); + for(i=0;i Date: Tue, 30 Oct 2018 16:56:53 +0530 Subject: [PATCH 3/3] circular double linked list --- list5.c | 248 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100644 list5.c diff --git a/list5.c b/list5.c new file mode 100644 index 0000000..abb8448 --- /dev/null +++ b/list5.c @@ -0,0 +1,248 @@ +//CDL list +#include +#include +#include +struct stud{ + char Roll_No[9]; + char Name[20]; + float CGPA; + struct stud*next; + struct stud*prev; +}*head=NULL,*temp,*save,*save2; +void ins_last() +{ + char roll[9],name[20]; + float cg; + printf("Enter Student Roll no.:\n"); + scanf("%s",roll); + printf("Enter Student Name:\n"); + scanf("%s",name); + printf("Enter Student CGPA:\n"); + scanf("%f",&cg); + temp=(struct stud*)malloc(sizeof(struct stud)); + strcpy(temp->Roll_No,roll); + strcpy(temp->Name,name); + temp->CGPA=cg; + temp->next=NULL; + temp->prev=NULL; + if(head==NULL) + { + head=temp; + head->next=head; + head->prev=head; + } + else + { + temp->next=head; + head->prev=temp; + save=head; + while(save->next!=head) + save=save->next; + save->next=temp; + temp->prev=save; + } +} +void ins_beg() +{ + char roll[9],name[20]; + float cg; + printf("Enter Student Roll no.:\n"); + scanf("%s",roll); + printf("Enter Student Name:\n"); + scanf("%s",name); + printf("Enter Student CGPA:\n"); + scanf("%f",&cg); + temp=(struct stud*)malloc(sizeof(struct stud)); + strcpy(temp->Roll_No,roll); + strcpy(temp->Name,name); + temp->CGPA=cg; + temp->next=NULL; + temp->prev=NULL; + if(head==NULL) + { + head=temp; + head->next=head; + head->prev=head; + } + else + { + temp->next=head; + head->prev=temp; + save=head; + while(save->next!=head) + save=save->next; + save->next=temp; + temp->prev=save; + head=temp; + } +} +void ins_pos() +{ + int pos; + char roll[9],name[20]; + float cg; + printf("Enter Student Roll no.:\n"); + scanf("%s",roll); + printf("Enter Student Name:\n"); + scanf("%s",name); + printf("Enter Student CGPA:\n"); + scanf("%f",&cg); + printf("Enter Position:\n"); + scanf("%d",&pos); + temp=(struct stud*)malloc(sizeof(struct stud)); + strcpy(temp->Roll_No,roll); + strcpy(temp->Name,name); + temp->CGPA=cg; + temp->next=NULL; + temp->prev=NULL; + if(head==NULL) + head=temp; + else + { + save=head; + pos-=1; + while(--pos) + save=save->next; + + save2=save->next; + save->next=temp; + temp->prev=save; + temp->next=save2; + save2->prev=temp; + } +} +void del_beg() +{ + if(head->next==head) + head=NULL; + if(head==NULL) + printf("Underflow\n"); + else + { + temp=head; + do + { + temp=temp->next; + }while(temp->next!=head); + temp->next=head->next; + head=head->next; + head->prev=temp; + } +} +void del_pos() +{ + int pos; + printf("Enter Position:\n"); + scanf("%d",&pos); + if(head->next==head) + head=NULL; + if(head==NULL) + printf("Underflow\n"); + else + { + save=head; + pos--; + while(--pos) + save=save->next; + save->next->next->prev=save; + save->next=save->next->next; + } +} +void del_end() +{ + if(head->next==head) + head=NULL; + if(head==NULL) + printf("Underflow\n"); + else + { + temp=head; + do + { + temp=temp->next; + }while(temp->next->next!=head); + temp->next=head; + head->prev=temp; + } +} +void disp() +{ + temp=head; + do + { + printf("Student Roll no.:%s\n",temp->Roll_No); + printf("Student Name:%s\n",temp->Name); + printf("Student CGPA:%f\n",temp->CGPA); + save=temp; + temp=temp->next; + }while(temp!=head); + printf("\nReverse Traversal\n"); + do + { + printf("Student Roll no.:%s\n",save->Roll_No); + printf("Student Name:%s\n",save->Name); + printf("Student CGPA:%f\n",save->CGPA); + //save=temp; + save=save->prev; + }while(save!=head->prev); +} +void search() +{ + char s[100]; + int flag=0; + printf("Enter Roll no:\n"); + scanf("%s",s); + temp=head; + do + { + if(!strcmp(s,temp->Roll_No)) + { + flag=1; + save=temp; + break; + } + else + flag=0; + temp=temp->next; + }while(temp!=head); + if(flag==1) + { + printf("Student Roll no.:%s\n",save->Roll_No); + printf("Student Name:%s\n",save->Name); + printf("Student CGPA:%f\n",save->CGPA); + } + else + printf("Not Found\n"); + +} +int main() +{ + printf("This program creates linear doubly circular linked list.\n"); + int choice=0; + while(choice!=9) + { + printf("1.Insert Beginning\n"); + printf("2.Insert Between\n"); + printf("3.Insert End\n"); + printf("4.Delete Beginning\n"); + printf("5.Delete between\n"); + printf("6.Delete End\n"); + printf("7.Search\n"); + printf("8.Display\n"); + printf("9.Exit\n"); + scanf("%d",&choice); + switch(choice) + { + case 1:ins_beg();break; + case 2:ins_pos();break; + case 3:ins_last();break; + case 4:del_beg();break; + case 5:del_pos();break; + case 6:del_end();break; + case 7:search();break; + case 8:disp();break; + } + } + return 0; +} +