Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <iostream>
- #include <string>
- #include <Windows.h>
- #include <math.h>
- #include <ctime>
- using namespace std;
- int main()
- {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- setlocale(LC_ALL, "Rus");
- short x,y,R,x1=0,y1=0;
- double K;
- srand(time(0));
- R=rand() % 20 + 40;
- x=rand() % (1001-2*R) + R;
- y=rand() % (1001-2*R) + R;
- cout<<"Программа задумала рандомную окружность с рандомным радиусом. Попробуйте попасть в неё!";
- cout<<"\nВведите координату х: ";
- cin>>x1;
- cout<<"\nВведите координату y: ";
- cin>>y1;
- if(!((pow((x1-x),2.))+(pow((y1-y),2.))<=R*R))
- cout<<"не попал"<<endl;
- while(!((pow((x1-x),2.))+(pow((y1-y),2.))<=R*R))
- {
- cout<<"\nВведите координату х: ";
- cin>>x1;
- cout<<"\nВведите координату y: ";
- cin>>y1;
- if(R*R<((pow((x1-x),2.))+(pow((y1-y),2.))) && ((pow((x1-x),2.))+(pow((y1-y),2.)))<=R*R*4)
- cout<<endl<<"горячо"<<endl;
- else
- if(R*R*4<=((pow((x1-x),2.))+(pow((y1-y),2.))) && ((pow((x1-x),2.))+(pow((y1-y),2.)))<=R*R*50)
- cout<<endl<<"холодно"<<endl;
- else
- if(R*R*50<=((pow((x1-x),2.))+(pow((y1-y),2.))))
- cout<<endl<<"очень холодно"<<endl;
- }
- cout<<"\nТочка("<<x1<<";"<<y1<<") попадает в круг с центром в точке ("<<x<<";"<<y<<") радиуса "<<R<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement