fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <queue>
  4. #include <windows.h>
  5. using namespace std;
  6.  
  7. struct pokoj
  8. {
  9. vector <int> korytarz;
  10.  
  11. void dodaj(int n) //korytarz
  12. {
  13. korytarz.push_back(n);
  14. }
  15.  
  16. };
  17.  
  18. int main()
  19. {
  20. vector <pokoj> labirynt;
  21.  
  22. for(int i=0; i<9; i++)
  23. labirynt.push_back(pokoj()); //0--1--2
  24. //| | |
  25. labirynt[0].dodaj(1); //3--4 5
  26. labirynt[0].dodaj(3); // |
  27. //6--7--8
  28. labirynt[1].dodaj(0);
  29. labirynt[1].dodaj(4);
  30. labirynt[1].dodaj(2);
  31.  
  32. labirynt[2].dodaj(1);
  33. labirynt[2].dodaj(5);
  34.  
  35. labirynt[3].dodaj(0);
  36. labirynt[3].dodaj(4);
  37.  
  38. labirynt[4].dodaj(1);
  39. labirynt[4].dodaj(3);
  40.  
  41. labirynt[5].dodaj(2);
  42. labirynt[5].dodaj(8);
  43.  
  44. labirynt[6].dodaj(7);
  45.  
  46. labirynt[7].dodaj(6);
  47. labirynt[7].dodaj(8);
  48.  
  49. labirynt[8].dodaj(5);
  50. labirynt[8].dodaj(7);
  51.  
  52. vector <int> gdzie_moge;
  53.  
  54. int wybor;
  55.  
  56. int k=0;
  57.  
  58. while(1)
  59. {
  60. for(int g=0; g<labirynt[k].korytarz.size(); g++)
  61. gdzie_moge.push_back(labirynt[k].korytarz[g]);
  62.  
  63. cout<<"Jestes w pokoju "<<k<<". Dokad chcesz isc dalej?"<<endl;
  64.  
  65. ponow_wybor:
  66.  
  67. for(int i=0; i<gdzie_moge.size(); i++)
  68. cout<<gdzie_moge[i]<<" ";
  69.  
  70. cout<<"\n";
  71.  
  72. cin>>wybor;
  73. //cls();
  74. system ("cls");
  75.  
  76. if(wybor == gdzie_moge[0])k=gdzie_moge[0];
  77. else if(wybor == gdzie_moge[1])k=gdzie_moge[1];
  78. else if(wybor == gdzie_moge[2])k=gdzie_moge[2];
  79. else
  80. {
  81. cout<<"Zly wybor. Wybierz ponownie."<<endl;
  82. goto ponow_wybor;
  83. }
  84.  
  85. gdzie_moge.clear();
  86. }
  87.  
  88. return 0;
  89. }
  90.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4:21: fatal error: windows.h: No such file or directory
compilation terminated.
stdout
Standard output is empty