Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. 169. void push(char *nama, int hh, int mm, char*order, int total, char*kelas, char*hp, int bayar){
  2. 170. curr = (data*)malloc(sizeof(struct data));
  3. 171. strcpy (curr->nama, nama);
  4. 172. curr->hh = hh;
  5. 173. curr->mm = mm;
  6. 174. curr->total = total+2000;
  7. 175. curr->bayar = bayar;
  8. 176. strcpy (curr->order, order);
  9. 177. strcpy (curr->kelas, kelas);
  10. 178. strcpy (curr->hp, hp);
  11. 179. if(!head){
  12. 180. head= tail = curr;
  13. 181. }
  14. 182. else{
  15. 183. if(curr->hh<head->hh){
  16. 184. head->prev = curr;
  17. 185. curr->next = head;
  18. 186. curr->prev = NULL;
  19. 187. head = curr;
  20. 188. }
  21. 189. else if(curr->hh>tail->hh){
  22. 190. tail->next = curr;
  23. 191. curr->prev = tail;
  24. 192. curr->next = NULL;
  25. 193. tail = curr;
  26. 194. }
  27. 195. else {
  28. 196. data *temp;
  29. 197. temp = head;
  30. 198. while (temp){
  31. 199. if(curr->hh<temp->hh){
  32. 200. curr->next = temp;
  33. 201. curr->prev = temp->prev;
  34. 202. (temp->prev)->next = curr;
  35. 203. temp->prev = curr;
  36. 204. break;
  37. 205. }
  38. 206. temp = temp->next;
  39. 207. }
  40. 208. }
  41. 209. }
  42. 210. tail->next = NULL;
  43. 211. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement