Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. if (uslovie == true)
  2. {
  3.  
  4. int number;
  5. char destination[10];
  6. char time[10];
  7.  
  8. printf("Vvedite nomer: ");
  9. scanf_s("%d", &number);
  10. printf("n");
  11.  
  12. printf("Vvedite punkt: ");
  13. gets_s(destination);
  14. printf("n");
  15.  
  16. printf("Vvedite vremya: ");
  17. gets_s(time);
  18. printf("n");
  19.  
  20. system("cls");
  21.  
  22. push(&head, number, destination, time);
  23. printf("Element uspeshno dobavlen!n");
  24. system("pause");
  25. break;
  26. }
  27.  
  28. else
  29. printf("Sozdaite spisok!n");
  30.  
  31. system("pause");
  32. break;
  33.  
  34. void push(avia **head, int number, char *destination, char *time)
  35. {
  36. avia *tmp = (avia*)malloc(sizeof(avia));
  37. if (*head == NULL)
  38. {
  39. tmp->number = number;
  40. for (int i = 0; i < 10; i++)
  41. tmp->destination[i] = destination[i];
  42. for (int i = 0; i < 10; i++)
  43. tmp->time[i] = time[i];
  44. tmp->next = NULL;
  45. *head = tmp;
  46. }
  47. else
  48. {
  49. tmp->number = number;
  50. for (int i = 0; i < 10; i++)
  51. tmp->destination[i] = destination[i];
  52. for (int i = 0; i < 10; i++)
  53. tmp->time[i] = time[i];
  54. tmp->next = *head;
  55. *head = tmp;
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement