Advertisement
edutedu

zaruri

Nov 4th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.20 KB | None | 0 0
  1. #include <graphics.h>
  2. #include <conio.h>
  3. #include <dos.h>
  4. #include <iostream>
  5. #include <string>
  6. #include <stdlib.h>
  7. #include <time.h>
  8. using namespace std;
  9.  
  10. #define KEY_UP 72
  11. #define KEY_X 120
  12.  
  13. void zar1 () {
  14.  
  15.     rectangle(200, 200, 400, 400);
  16.     circle(300, 300, 20);
  17.     settextstyle(8, 0, 5);
  18.     outtextxy(100,100, "A picat zarul cu fata 1");
  19. }
  20. void zar2 () {
  21.  
  22.     rectangle(200, 200, 400, 400);
  23.     circle(260, 300, 20);
  24.     circle(340, 300, 20);
  25.     settextstyle(8, 0, 5);
  26.     outtextxy(100, 100, "A picat zarul cu fata 2");
  27.  
  28. }
  29. void zar3 () {
  30.  
  31.     rectangle(200, 200, 400, 400);
  32.     circle(240, 300, 20);
  33.     circle(300, 300, 20);
  34.     circle(360, 300, 20);
  35.     settextstyle(8, 0, 5);
  36.     outtextxy(100, 100, "A picat zarul cu fata 3");
  37. }
  38. void zar4 () {
  39.  
  40.     rectangle(200, 200, 400, 400);
  41.     circle(250, 250, 20);
  42.     circle(350, 250, 20);
  43.     circle(350, 350, 20);
  44.     circle(250, 350, 20);
  45.     settextstyle(8, 0, 5);
  46.     outtextxy(100, 100, "A picat zarul cu fata 4");
  47. }
  48. void zar5 () {
  49.  
  50.     rectangle(200, 200, 400, 400);
  51.     circle(250, 250, 20);
  52.     circle(350, 250, 20);
  53.     circle(350, 350, 20);
  54.     circle(250, 350, 20);
  55.     circle(300, 300, 20);
  56.     settextstyle(8, 0, 5);
  57.     outtextxy(100, 100, "A picat zarul cu fata 5");
  58. }
  59. void zar6 () {
  60.  
  61.     rectangle(200, 200, 400, 400);
  62.     circle(250, 250, 20);
  63.     circle(350, 250, 20);
  64.     circle(350, 350, 20);
  65.     circle(250, 350, 20);
  66.     circle(300, 250, 20);
  67.     circle(300, 350, 20);
  68.     settextstyle(8, 0, 5);
  69.     outtextxy(100, 100, "A picat zarul cu fata 6");
  70. }
  71.  
  72. int main()
  73. {
  74.      initwindow(800,600);
  75.      int i;
  76.      char tasta;
  77.      while(true)
  78.      {
  79.         if(kbhit()) tasta=getch();
  80.         if(tasta=='r')
  81.         {
  82.             cleardevice();
  83.             srand(time(NULL));
  84.             i=rand()%6+1;
  85.             if(i==1)
  86.                 zar1();
  87.             else if(i==2)
  88.                 zar2();
  89.             else if(i==3)
  90.                 zar3();
  91.             else if(i==4)
  92.                 zar4();
  93.             else if(i==5)
  94.                 zar5();
  95.             else
  96.                 zar6();
  97.             tasta='a';
  98.         }
  99.      }
  100.     getch();
  101.     closegraph();
  102.     return 0;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement