You are on page 1of 6

#include <iostream>

#include <math.h>

#include <graphics.h>

#include <winbgim.h>

using namespace std;

struct casuta{

int x,y;

}T[11][11];

void tabla(int x , int y)

int nrc, nrl;

nrc=x/10;

nrl=y/10;

for(int i=0;i<x;i+=nrc)

for(int j=nrl;j<=y;j+=nrl)

line(i,j,i+nrc,j);

line(i,j-nrl,i,j);

}
int interx(int a , int x )

int nrc , k=0;

nrc=x/10;

while(a>nrc)

a=a-nrc;

k++;

return k;

int intery(int a , int x )

int nrc , k=0;

nrc=x/10;

while(a>nrc)

a=a-nrc;

k++;

}
if(a>nrc/2)

return k;

else

return k-1;

int main()

int x=800 , y=600 , opt , optt, n;

cout<<"MENIU:"<<endl<<endl;

cout<<"1 -> START JOC"<<endl;

cout<<"2 -> OPTIUNI"<<endl;

cout<<"0 -> EXIT"<<endl;

cin>>opt;

do

{if(opt==1)

initwindow(x,y);

tabla(x,y);

POINT cursorPosition;

int mx, my;


while(1)

GetCursorPos(&cursorPosition);

mx=cursorPosition.x;

my=cursorPosition.y;

if(GetAsyncKeyState(VK_LBUTTON))

bar(interx(mx , x)*(x/10),intery(my,y)*(y/10),(interx(mx , x)+1)*(x/10),(intery(my,y)+1)*(y/10));

getch(); closegraph();

if(opt==2)

cout<<"OPTIUNI:";

cout<<"1 -> SETEAZA REZOLUTIA ";

cout<<"2 -> SETEAZA DIMENSIUNEA TABLEI ";

cout<<"0 -> BACK"<<endl;

cin>>optt;

do{

if(optt==1)

cout<<"Seteaza rezolutia:";

cin>>x>>y;
}

if(optt==2)

{cout<<"Seteaza dimensiunea tablei [10 - 20]:";

cin>>n;

if(optt==0)

break;

cin>>optt;

while(optt!=0);

if (opt==0)

break;

cout<<"MENIU:"<<endl<<endl;

cout<<"1 -> START JOC"<<endl;

cout<<"2 -> OPTIUNI"<<endl;

cout<<"0 -> EXIT"<<endl;

cin>>opt;

while(opt!=0);
return 0;

Am reusit sa colorez la click fiecare casetuta, trebuie si sa modific culoare corespunzatoare fiecarui
jucator.

You might also like