Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void my_abs() {
- double x;
- cout << "Enter x: "; cin >> x;
- if (x < 0) {
- x = -x;
- }
- /*
- else {
- //x = x;
- }
- */
- cout << "|x|: " << x << endl;
- }
- void my_abs_short() {
- double x, result;
- cout << "Enter x: "; cin >> x;
- if (x < 0)
- result = -x;
- else
- result = x;
- cout << "| " << x << " |= " << result << endl;
- }
- double abs_short(double x) {
- if (x < 0) x = -x;
- return x;
- }
- void get_max() {
- double x1 = 5;
- double x2 = 3;
- double x3 = 7;
- double max = x1;
- if (x2 > max) {
- max = x2;
- }
- if (x3 > max) {
- max = x3;
- }
- cout << max << endl;
- }
- void is_button_click() {
- const int win_width = 1920;
- const int win_heigh = 1080;
- const int button_width = 100;
- const int button_height = 50;
- const int button_x = 700;
- const int button_y = 600;
- int x = 700;
- int y = 611;
- bool is_click = true;
- // Проверка попадания в экран
- if (x < 0) {
- is_click = false;
- }
- if (y < 0) {
- is_click = false;
- }
- if (x > win_width) {
- is_click = false;
- }
- if (y > win_heigh) {
- is_click = false;
- }
- // Проверка клика по кнопке
- if (x < button_x) {
- is_click = false;
- }
- if (y < button_y) {
- is_click = false;
- }
- if (x > button_width + button_x) {
- is_click = false;
- }
- if (y > button_height + button_y) {
- is_click = false;
- }
- if (is_click) {
- cout << "Bingo" << endl;
- }
- else {
- cout << "Milk" << endl;
- }
- }
- int main() {
- //my_abs_short();
- //cout << abs_short(-7) << endl;
- //get_max();
- is_button_click();
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment