#include #include #include #include using namespace std; double w1[100]={0}; double w2[100]={0}; char desk[10][10]; double winer[100]; double x, y; double x_1, y_1; double L; int I; double ki=0; void _new() { for(int i=0;i<10;i++) for(int j=0;j<10;j++) desk[i][j]='.'; } void _w() { srand(time_t(NULL)); double k=0; for(int i=0;i<100;i++) { k=rand()%201-100; w1[i]=k/100; k=rand()%201-100; w2[i]=k/100; // cout << w1[i] << '\n' << w2[i] << endl; } } void _ras(double x, double y, int i) { } void _out() { for(int i=0;i<10;i++) { for(int j=0;j<10;j++) cout << desk[i][j] << " "; cout << endl; } cout << endl; } int main() { _w(); do { system("CLS"); x=rand()%201 -100; x=x/100; cout << "X:" << x << endl; y=rand()%201 -100; y=y/100; cout << "Y:" << y << endl; cout << endl; if ((x>=-1) && (x<=1) && (y>=-1) && (y<=1)) { ki=rand()%21-10; ki=ki/100; x_1=x+ki; ki=rand()%21-10; ki=ki/100; y_1=y+ki; _new(); desk[rand()%10][rand()%10]='O'; _out(); if(x_1>1) x_1=1; if(x_1<-1) x_1=-1; cout << "first weight is " << x_1 <<'\n'<< "second weight is " << y_1 << endl; } else { _new(); _out(); } } while(getch()!=27); cin.get(); return 0; }