using System;
class Rectangle {
public int x;
public int y;
public int w;
public int h;
public Rectangle(int xr, int yr, int wr, int hr)
{
x=xr;
y=yr;
w=wr;
h=hr;
}
public void IsInto(int x0,int y0)
if(x <= x0 && x0<=x+w && y <= y0 && y0<=y+h)
Console.WriteLine("Yes");
else
Console.WriteLine("No");
class Program
static void Main()
Rectangle R = new Rectangle(0,0,1920,1080);
R.IsInto(150,220);
R.IsInto(2000,1080);
Вот, нашел на одном из сайтов: #include <iostream>
#include <conio.h>
#include <cstdlib>
#include <ctime>
using namespace std;
int main (){
srand(time(0));
int n, one, two, co=0, ol, k=0, var, sum1=0, sum2=0;
bool kto=true;
cout << "Privet davaii sigraem v kosti.\nPobedit tot u kogo suma 3 broskov budet bolshe\n\n";
while (k<3)
cout << "\n1 - Brositj kubik\n2 - Vijti\nViberi variant: ";
cin >> var;
if (var==1)
for (int j=0; j<=1; j++)
one=1+(rand()%6);
two=1+(rand()%6);
cout << "\n";
if (kto) cout << "\tTvoi kubiki\n";
if (!kto) cout << "\tMoi kubiki\n";
for (int i=1; i<=5; i++)
if (i==1) n=1;
else if (i==2 && one==1) n=2;
else if (i==2 && one==3 || i==2 && one==2) n=3;
else if (i==2 && one==4 || i==2 && one==5 || i==2 && one==6) n=4;
else if (i==3 && one==3 || i==3 && one==1 || i==3 && one==5) n=5;
else if (i==3 && one==2 || i==3 && one==4) n=2;
else if (i==3 && one==6) n=4;
else if (i==4 && one==1) n=2;
else if (i==4 && one==3 || i==4 && one==2) n=6;
else if (i==4 && one==4 || i==4 && one==5 || i==4 && one==6) n=4;
else if (i==5) n=7;
switch (n){
case 1:
cout << (char)201 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)187;
break;
case 2:
cout << (char)186 << " " << (char)186;
case 3:
cout << (char)186 << " o " << (char)186;
case 4:
cout << (char)186 << " o o " << (char)186;
case 5:
case 6:
case 7:
cout << (char)200 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)188;
if (co%2==0) {
cout << "\t";
i--;
ol=one;
one=two;}
else {
cout << endl;
one=ol; }
co++;
if (kto){
sum1=sum1+one+two;
kto=false;
continue;
if(!kto){
sum2=sum2+one+two;
kto=true;
else if (var==2) return 0;
cout << "\n!!! Viberi variant 1 ili 2 !!!\n";
continue;}
k++;
cout << "\nTvoj rezultat = " << sum1 << endl << "Moj rezultat = " << sum2 << endl;
if (sum1>sum2)
cout << "\n\tTi pobedil ;)";
else cout << "\n\tTi proigral :(";
getch ();
using System;
class Rectangle {
public int x;
public int y;
public int w;
public int h;
public Rectangle(int xr, int yr, int wr, int hr)
{
x=xr;
y=yr;
w=wr;
h=hr;
}
public void IsInto(int x0,int y0)
{
if(x <= x0 && x0<=x+w && y <= y0 && y0<=y+h)
Console.WriteLine("Yes");
else
Console.WriteLine("No");
}
}
class Program
{
static void Main()
{
Rectangle R = new Rectangle(0,0,1920,1080);
R.IsInto(150,220);
R.IsInto(2000,1080);
}
}
Вот, нашел на одном из сайтов: #include <iostream>
#include <conio.h>
#include <cstdlib>
#include <ctime>
using namespace std;
int main (){
srand(time(0));
int n, one, two, co=0, ol, k=0, var, sum1=0, sum2=0;
bool kto=true;
cout << "Privet davaii sigraem v kosti.\nPobedit tot u kogo suma 3 broskov budet bolshe\n\n";
while (k<3)
{
cout << "\n1 - Brositj kubik\n2 - Vijti\nViberi variant: ";
cin >> var;
if (var==1)
{
for (int j=0; j<=1; j++)
{
one=1+(rand()%6);
two=1+(rand()%6);
cout << "\n";
if (kto) cout << "\tTvoi kubiki\n";
if (!kto) cout << "\tMoi kubiki\n";
cout << "\n";
for (int i=1; i<=5; i++)
{
if (i==1) n=1;
else if (i==2 && one==1) n=2;
else if (i==2 && one==3 || i==2 && one==2) n=3;
else if (i==2 && one==4 || i==2 && one==5 || i==2 && one==6) n=4;
else if (i==3 && one==3 || i==3 && one==1 || i==3 && one==5) n=5;
else if (i==3 && one==2 || i==3 && one==4) n=2;
else if (i==3 && one==6) n=4;
else if (i==4 && one==1) n=2;
else if (i==4 && one==3 || i==4 && one==2) n=6;
else if (i==4 && one==4 || i==4 && one==5 || i==4 && one==6) n=4;
else if (i==5) n=7;
switch (n){
case 1:
cout << (char)201 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)187;
break;
case 2:
cout << (char)186 << " " << (char)186;
break;
case 3:
cout << (char)186 << " o " << (char)186;
break;
case 4:
cout << (char)186 << " o o " << (char)186;
break;
case 5:
cout << (char)186 << " o " << (char)186;
break;
case 6:
cout << (char)186 << " o " << (char)186;
break;
case 7:
cout << (char)200 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)188;
break;
}
if (co%2==0) {
cout << "\t";
i--;
ol=one;
one=two;}
else {
cout << endl;
one=ol; }
co++;
}
if (kto){
sum1=sum1+one+two;
kto=false;
continue;
}
if(!kto){
sum2=sum2+one+two;
kto=true;
}
}
}
else if (var==2) return 0;
else {
cout << "\n!!! Viberi variant 1 ili 2 !!!\n";
continue;}
k++;
}
cout << "\nTvoj rezultat = " << sum1 << endl << "Moj rezultat = " << sum2 << endl;
if (sum1>sum2)
cout << "\n\tTi pobedil ;)";
else cout << "\n\tTi proigral :(";
getch ();
}