Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 169. void push(char *nama, int hh, int mm, char*order, int total, char*kelas, char*hp, int bayar){
- 170. curr = (data*)malloc(sizeof(struct data));
- 171. strcpy (curr->nama, nama);
- 172. curr->hh = hh;
- 173. curr->mm = mm;
- 174. curr->total = total+2000;
- 175. curr->bayar = bayar;
- 176. strcpy (curr->order, order);
- 177. strcpy (curr->kelas, kelas);
- 178. strcpy (curr->hp, hp);
- 179. if(!head){
- 180. head= tail = curr;
- 181. }
- 182. else{
- 183. if(curr->hh<head->hh){
- 184. head->prev = curr;
- 185. curr->next = head;
- 186. curr->prev = NULL;
- 187. head = curr;
- 188. }
- 189. else if(curr->hh>tail->hh){
- 190. tail->next = curr;
- 191. curr->prev = tail;
- 192. curr->next = NULL;
- 193. tail = curr;
- 194. }
- 195. else {
- 196. data *temp;
- 197. temp = head;
- 198. while (temp){
- 199. if(curr->hh<temp->hh){
- 200. curr->next = temp;
- 201. curr->prev = temp->prev;
- 202. (temp->prev)->next = curr;
- 203. temp->prev = curr;
- 204. break;
- 205. }
- 206. temp = temp->next;
- 207. }
- 208. }
- 209. }
- 210. tail->next = NULL;
- 211. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement