Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. #include <iostream>
  2. struct Poezda {
  3. int numb;
  4. char* city;
  5. char* city1;
  6. double chasv;
  7. double chasp;
  8.  
  9. };
  10.  
  11. int main()
  12. {
  13. struct Poezda mass[4], *point = &mass[0];
  14. int find = 4;
  15.  
  16. mass[0].numb = 3244;
  17. mass[1].numb = 5677;
  18. mass[2].numb = 4589;
  19. mass[3].numb = 6734;
  20.  
  21. mass[0].city = "Odessa";
  22. mass[1].city = "Kiyv";
  23. mass[2].city = "Lviv";
  24. mass[3].city = "Donetsk";
  25.  
  26. mass[0].city1 = "Kharkiv";
  27. mass[1].city1 = "Kharkiv";
  28. mass[2].city1 = "Kharkiv";
  29. mass[3].city1 = "Kharkiv";
  30.  
  31. mass[0].chasv = 8.00;
  32. mass[1].chasv = 9.00;
  33. mass[2].chasv = 10.00;
  34. mass[3].chasv = 7.00;
  35.  
  36. mass[0].chasp = 14.00;
  37. mass[1].chasp = 16.00;
  38. mass[2].chasp = 22.00;
  39. mass[3].chasp = 13.00;
  40.  
  41. std::cout << "Vvedite chas pribitiya" << std::endl;
  42. double chas;
  43. std::cin >> chas;
  44. for (int i = 0; i < 4; i++, point++)
  45. {
  46. if (((*point).chasp) == chas)
  47. {
  48. std::cout << " Nomer poezda " << ((*point).numb) << std::endl << "Marshrut " << ((*point).city) << ((*point).city1) << std::endl << std::endl <<
  49. (*point).chasv << std::endl << ((*point).chasp) << std::endl;
  50.  
  51.  
  52.  
  53. }
  54. else {
  55. find--;
  56.  
  57. }
  58. if (find == 0) {
  59. std::cout << "Net takogo poezda" << std::endl;
  60. }
  61.  
  62. }
  63.  
  64. system("pause");
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement