Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <graphics.h>
- using namespace std;
- int main()
- {
- float x, y, x1, y1, R;
- float i = 0;
- cout <<"write R: ";
- cin >> R;
- initwindow(100*R+100,100*R+100); //oci koordinat
- setfillstyle(1,15);
- line(0,50*R+50,100*R+100,50*R+50);
- line(50*R+50,0,50*R+50,100*R+100);
- line(50*R+50,0,50*R+40,10);
- line(50*R+50,0,50*R+60,10);
- line(100*R+100,50*R+50,100*R+90,50*R+60);
- line(100*R+100,50*R+50,100*R+90,50*R+40);
- setcolor(15); //krug
- circle(50*R+50,50*R+50,R*50);
- circle(50*R+50,50*R+50,R*50+1);
- setfillstyle(1,15); //ogranichenie
- line(50,50*R+50,50*R+50,50);
- setfillstyle(1,8);
- floodfill(50,100*R+90,15); //zalivka oblostei
- setfillstyle(1,8);
- floodfill(50+25*R,50+25*R,15);
- setfillstyle(1,8);
- floodfill(75*R+75,75*R+75,15);
- while (i > 0)
- {
- cout <<"write x: ";
- cin >> x;
- cout <<"write y: ";
- cin >> y;
- if (((x >= 0) and (y <= 0) and (x*x + y*y <= R*R)) or ((x*x + y*y <= R*R) and (x <= 0) and (y >= 0) and (x <= y - R)) or ((x*x + y*y >= R*R) and (x <= 0) and (y <= 0)))
- {
- x1 = 50*R + 50 + x*50; // tochki
- y1 = 50*R +50 - y*50;
- setcolor(10);
- circle(x1,y1,3);
- setfillstyle(1,10);
- floodfill(x1,y1,10);
- cout << "vi popali " <<"\n";
- }
- else
- {
- x1 = 50*R + 50 + x*50; //tochki
- y1 = 50*R +50 - y*50;
- setcolor(12);
- circle(x1,y1,3);
- setfillstyle(1,12);
- floodfill(x1,y1,12);
- cout << "no:( " <<"\n";
- }
- i -= 1;
- }
- getch();
- closegraph();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement