Загрузка...

Помогите , пожалуйста , решить задачку на плюсах .

Тема в разделе C/C++ создана пользователем sxanx233 27 дек 2022. 173 просмотра

  1. sxanx233
    sxanx233 Автор темы 27 дек 2022 Заблокирован(а) 1 28 окт 2022
    [IMG]я 3 вариант
     
  2. СтартерТут
    СтартерТут 27 дек 2022 Заблокирован(а) 0 27 дек 2022
    Могу решить за 200, если нужно пиши в ЛС
     
  3. olmovc
    olmovc 1 янв 2023 0 1 янв 2023
    C
    #include <iostream>
    #include <string>

    using std::cin;
    using std::cout;
    using std::string;

    int main()
    {
    float x = 0, y = 0;
    const string MSG_BELONG = "\nthe point with coordinates x, y belongs to the plane\n";
    const string MSG_NOT_BELONG = "\nthe point with coordinates x, y does not belongs to the plane\n";
    cout << "Enter X: ";
    cin >> x;
    cout << "Enter Y: ";
    cin >> y;
    cout << "\n1 option ((x >= -1.0 && x <= 1.0) && (y >= -1.0 && y <= 1.0))";
    if ((x >= -1.0 && x <= 1.0) && (y >= -1.0 && y <= 1.0))
    {
    cout << MSG_BELONG;
    }
    else
    {
    cout << MSG_NOT_BELONG;
    }
    cout << "------------------------------------------\n";
    cout << "\n2 option x1^2 + y1^2 < R1 && x2^2 + y2^2 > R2\n";
    float radius = x * x + y * y;
    if ((radius <= 1.0f) && (radius >= 0.5f))
    {
    cout << MSG_BELONG;
    }
    else
    {
    cout << MSG_NOT_BELONG;
    }
    cout << "------------------------------------------\n";
    cout << "\n3 option x1^2 + y1^2 < R1 && x2^2 + y2^2 > R2 && y >= 0\n";
    radius = x * x + y * y;
    if ((radius <= 2.0f) && (radius >= 2.5f) && (y >= 0))
    {
    cout << MSG_BELONG;
    }
    else
    {
    cout << MSG_NOT_BELONG;
    }
    cout << "------------------------------------------\n";
    cout << "\n4 option ((x <= -1.0f) || (x >= 1.0f)) && (y >= 1.0)\n";
    if (((x <= -1.0f) || (x >= 1.0f)) && (y >= 1.0))
    {
    cout << MSG_BELONG;
    }
    else if (((x > -1) && (x <= 0)) && (y >= -1.0 * x))
    {
    cout << MSG_BELONG;
    }
    else if (((x > 0) && (x < 1)) && (y >= x))
    {
    cout << MSG_BELONG;
    }
    else
    {
    cout << MSG_NOT_BELONG;
    }
    cout << "------------------------------------------";
    std::getchar();
    return 0;
    }
     
Загрузка...
Top