HabKaffee

Untitled

Apr 3rd, 2020
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Bus.h"
  2. #define _CRT_SECURE_NO_WARNINGS
  3. #include <stdio.h>
  4. #include <math.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7.  
  8. const int size = 50;
  9. const int size1 = 4;
  10.  
  11. int main() {
  12. int current=0;
  13. char* num1 = (char*)malloc(1 * sizeof(char));
  14. char** stops1 = (char**)malloc(1 * sizeof(char));
  15. BUS bus = { num1, stops1, 50, 0 };
  16. BUS_ARRAY busArr[size] = { &bus, 50, 0 };
  17. char stops[size][2 * size] = { '0' };
  18. char num[size] = { '0' };
  19. int count = 0;
  20. for (int i = 0; i < size1 - 1; i++) {
  21. puts("Please, enter the number of way");
  22. for (int j = 0; num[j] != '\0'; j++) {
  23. scanf("%c", num[j]);
  24. }
  25. puts("Enter stops");
  26. for (int j = 0; j < size1; j++) {
  27. for (int k = 0; stops[j][k] != '\0'; k++) {
  28. scanf("%c", stops[j][k]);
  29. }
  30. count++;
  31. }
  32. declareBus(&bus, num, (char**)stops, count, i);
  33. addBusToBusArr(busArr, &bus, i);
  34. nullingArrays(num, (char**)stops);
  35. current++;
  36. }
  37. for (int i = 0; i < size1 - 1; i++) {
  38. printBus(&bus, i);
  39. }
  40. char stopAdd[size] = { '0' };
  41. puts("Enter stop");
  42. for (int j = 0; num[j] != '\0'; j++) {
  43. scanf("%c", num[j]);
  44. }
  45. addStops(stopAdd,&busArr->bus[1], current);
  46.  
  47. char changeStop[size] = { '0' };
  48. puts("Enter stop to change");
  49. for (int j = 0; changeStop[j] != '\0'; j++) {
  50. scanf("%c", changeStop[j]);
  51. }
  52. changeStops(&busArr->bus[1],changeStop,2, current);
  53. int place = 1;
  54. addStopsToWay(stopAdd, &busArr->bus[1], current, place);
  55. changeStopsOrder(&busArr->bus[1], current, 1,2);
  56. int number = 1;
  57. deleteBusStopByNum(&bus,number,current);
  58. char name[size] = { '0' };
  59. puts("Enter stop to del");
  60. for (int j = 0; name[j] != '\0'; j++) {
  61. scanf("%c", name[j]);
  62. }
  63. deleteBusStopByName(&busArr->bus[1], name, current);
  64. printBusArr(busArr);
  65. addBusToBusArr(busArr,&bus,current);
  66. deleteBusFromArr(busArr, number);
  67. changeBus(busArr,&bus,number,current);
  68.  
  69.  
  70. return 0;
  71. }
RAW Paste Data Copied