L
L
lemonlimelike2019-10-20 22:02:08
C++ / C#
lemonlimelike, 2019-10-20 22:02:08

How to calculate if the coordinates belong to this graph?

Hello! Dali dz at the university: calculate whether the given coordinates belong to the function graph in the given area. Here is the graph itself: 5dacae2a7d209941893898.png
I calculated the coordinates for the entire graph, that is, from -4 to 4 in Ox and from -1 to 2 in Oy, but I can’t set such a condition that the coordinates of the points from (-1,2) to (3.2) did not belong to the graph. How to set such a condition? Help pliz. Here is my actual code:

#include <iostream>
using namespace std;
int main(){
    float x,y;
    bool bl;
    bl = true;
    int i;
    i=1;
    while(bl){
        cout << i<<")"<<"Enter x=";
        cin >> x;
        cout <<i<<")"<<"Enter y=";
        cin >> y;
        if(y<=2 && y>=-1 && y<=(10+3*x)/2 && y<=11-3*x){
            cout << "Наши точки: "<<"("<<x<<","<<y<<")"<<endl;

        }
        
        else{
            cout << "Точки не принадлежат графику"<<endl;
        }
        i++;
    }
    
    return 0;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2019-10-20
@lemonlimelike

Imagine how you would conditionally cut this part out of a sheet of metal on a CNC machine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question