Essays.club - Получите бесплатные рефераты, курсовые работы и научные статьи
Поиск

Условные операторы C++

Автор:   •  Апрель 28, 2019  •  Лабораторная работа  •  5,984 Слов (24 Страниц)  •  125 Просмотры

Страница 1 из 24

Вариант 4

[pic 1]

#include "pch.h"

#include 

#include

using namespace std;

int main()

{

        setlocale(LC_ALL, "rus");

        int a, b, c, d;

        int a1, b1, c1, d1;

        cout << "Введите а:";

        cin >> a1;

        cout << "Введите b:";

        cin >> b1;

        cout << "Введите c:";

        cin >> c1;

        cout << "Введите d:";

        cin >> d1;

        a = a1 % 2;

        b = b1 % 2;

        c = c1 % 2;

        d = d1 % 2;

        if (a != 0, a1 < 0)

        {

                if (b != 0, b1 < 0)

                {

                        if (c != 0, c1 < 0)

                        {

                                if (d != 0, d1 < 0) cout << a1 * b1*c1*d1<<endl;

                                else cout << a1 * b1*c1 << endl;

                        }

                        else

                        {

                                if (d != 0, d1 < 0) cout << a1 * b1*d1 << endl;

                                else cout << a1 * b1 << endl;

                        }

                }

                else {

                        if (c != 0, c1 < 0)

                        {

                                if (d != 0, d1 < 0) cout << a1 * c1*d1 << endl;

                                else cout << a * c << endl;

                        }

                        else

                        {

                                if (d != 0, d1 < 0) cout << a1 * d1 << endl;

                                else cout << a1 << endl;

                        }

                        

                }

        }

        else

        {

                if (b != 0, b1 < 0)

                {

                        if (c != 0, c1 < 0)

                        {

                                if (d != 0, d1 < 0) cout << b1 * c1*d1 << endl;

                                else cout<< b1 * c1 << endl;

                        }

                        else

                        {

                                if (d != 0, d1 < 0) cout << b1 * d1 << endl;

                                else cout << b1 << endl;

                        }

                }

                else

                {

                        if (c != 0, c1 < 0)

                        {

                                if (d != 0, d1 < 0)cout << c1 * d1 << endl;

                                else cout << c1 << endl;

                        }

                        else

                        {

                                if (d != 0, d1 < 0)cout <<  d1 << endl;

                                else cout << "ERROR!!!" << endl;

                        }

                }

...

Скачать:   txt (14.1 Kb)   pdf (611.5 Kb)   docx (169.4 Kb)  
Продолжить читать еще 23 страниц(ы) »
Доступно только на Essays.club