Advertisement
VQLShop

Untitled

Dec 17th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <string>
  4. #include <cstdlib>
  5. using namespace std;
  6. int pola[10][10]]; //pola liczone od 0-9 !
  7. string start;
  8.  
  9. using byte = unsigned char;
  10.  
  11.  
  12. int main()
  13.  
  14. {
  15.  
  16. cout << "Gra w statki dla Pani Moniki :D"<<endl;
  17.  
  18. Sleep (1200);
  19. cout << "Zasady: "<<endl;
  20. Sleep (1200);
  21. cout << "1. Strzela tylko Gracz. "<<endl;
  22. Sleep (1200);
  23. cout << "2. Gra toczy sie dopolki nie zatopisz wszystkich statkow przeciwnika. "<<endl;
  24. Sleep (1200);
  25. cout << "3. Prosze nie wchodzic w kod Gry! :D "<<endl<<endl<<endl;
  26.  
  27.  
  28. Sleep (3000);
  29. cout << "Wpisz "Start" aby zaczac: ";
  30. cin >> start <<endl<<endl<<endl;
  31.  
  32.  
  33. unsigned strzaly = 0;
  34.  
  35.     byte statki = 9; //ilosc statkow
  36.  
  37.     byte pola[10][10];
  38.  
  39.     // 0 - puste pole
  40.  
  41.     // 1 - pole ze statkiem
  42.  
  43.     // 2 - pole trafione przez uzytkownika
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50. for (byte i=0; i<statki; ++i)
  51.     {
  52.  
  53.         byte x,y;
  54.         do
  55.  
  56.         {
  57.  
  58.             x=rand()%10;
  59.  
  60.             y=rand()%10;
  61.  
  62.         }
  63.  
  64.         while(pola[x][y] == 1);
  65.  
  66.         pola[x][y] = 1;
  67.  
  68.     }
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement