Posts

Coding kasir

#include <stdio.h> #include <string.h> #include <stdlib.h> struct node{ char nama[101];  int variabel;  struct node *prev, *next; }*head, *tail; void pushData(int variabel, char nama[]){  struct node *NodeBaru = (struct node*)malloc(sizeof(struct node));  struct node *zone = head;  NodeBaru->variabel=variabel;  strcpy(NodeBaru->nama, nama);  NodeBaru -> prev=NULL;  NodeBaru -> next=NULL;  if(head==NULL){   head=tail=NodeBaru;  }  else if(variabel<head->variabel){   NodeBaru->next=head;   head->prev=NodeBaru;   head=NodeBaru;  }  else if(variabel>=tail->variabel){   tail ->next = NodeBaru;   NodeBaru->prev=tail;   tail=NodeBaru;  }  else{   while(variabel>=zone->next->variabel){    zone = zone->next;   }   NodeBaru->prev=zone;   NodeBaru->nex...