
Лабораторная работа № 4 Организация разветвлений в программах.
Цель работы:
ознакомиться с операторами if и case.
научиться составлять программы с использованием указанных операторов.
Задание:
Решить задачи 1-5:
(условия задач выбрать из приложения по номерам, указанным преподавателем)
подготовить отчет о лабораторной работе.
отчет должен содержать для задачи 1 и 2 ответ и обоснованное решение, для остальных задач:
условие задания;
блок-схему алгоритма;
текст программы;
копию окна работающего приложения с результатами работы программы;
анализ результатов.
Приложение 1.
Задача 1. Вычислить значение выражения при заданных значениях переменных X,y
X=true Y=true 1 1) not (x and y) or x or not y 2) (y or y) or y and not x 3) not (x and y or y) and x or y 4) y and y or y or y or y or not x 5) not (not x and not y) or not x |
X=true Y=true 3 1) x or y and x or y and not x or not y 2) y or not x and (not x or not y or not y) 3) not (x and x and x) or not (y or y or y) 4) x or y and (x or y and not x) and not y 5) not x and not x or not (x and y or y) or y |
X=true Y=true 2 1) not (x and y) or (x or not y)
4) not x and (y or y and x) or y 5) not (not x and not y or not x) or y |
X=true Y=true 4 1) x or (y and x or y) and (not x or not y) 2) y or (not x and not x) or (not y or not y) 3) not (not x and not y ) or not x or x 4) (x or y) and (x or y) and (not x and not y) 5) not (x and y) or not (not y and x) or y |
X=false Y=true 5 1) not (x and y) or x or not y 2) (y or y) or y and not x 3) not (x and y or y) and x or y 4) y and y or y or y or y or not x 5) not (not x and not y) or not x |
X=false Y=true 6I 1) x or y and x or y and not x or not y 2) y or not x and (not x or not y or not y) 3) not (x and x and x) or not (y or y or y) 4) x or y and (x or y and not x) and not y 5) not x and not x or not (x and y or y) or y |
X=false Y=true 7 1) not (x and y) or (x or not y)
4) not x and (y or y and x) or y 5) not (not x and not y or not x) or y |
X=false Y=true 8 1) x or (y and x or y) and (not x or not y) 2) y or (not x and not x) or (not y or not y) 3) not (not x and not y ) or not x or x 4) (x or y) and (x or y) and (not x and not y) 5) not (x and y) or not (not y and x) or y |
X=true Y=false 9 1) not (x and y) or x or not y 2) (y or y) or y and not x 3) not (x and y or y) and x or y 4) y and y or y or y or y or not x 5) not (not x and not y) or not x |
X=true Y=false 10 1) x or y and x or y and not x or not y 2) y or not x and (not x or not y or not y) 3) not (x and x and x) or not (y or y or y) 4) x or y and (x or y and not x) and not y 5) not x and not x or not (x and y or y) or y |
X=true Y=false 11 1) not (x and y) or (x or not y)
4) not x and (y or y and x) or y 5) not (not x and not y or not x) or y |
X=true Y=false 12 1) x or (y and x or y) and (not x or not y) 2) y or (not x and not x) or (not y or not y) 3) not (not x and not y ) or not x or x 4) (x or y) and (x or y) and (not x and not y) 5) not (x and y) or not (not y and x) or y |
X=false Y=false 13 1) not (x and y) or x or not y 2) (y or y) or y and not x 3) not (x and y or y) and x or y 4) y and y or y or y or y or not x 5) not (not x and not y) or not x |
X=false Y=false 14 1) x or y and x or y and not x or not y 2) y or not x and (not x or not y or not y) 3) not (x and x and x) or not (y or y or y) 4) x or y and (x or y and not x) and not y 5) not x and not x or not (x and y or y) or y |
X=false Y=false 15 1) not (x and y) or (x or not y)
4) not x and (y or y and x) or y 5) not (not x and not y or not x) or y |
X=false Y=false 16 1) x or (y and x or y) and (not x or not y) 2) y or (not x and not x) or (not y or not y) 3) not (not x and not y ) or not x or x 4) (x or y) and (x or y) and (not x and not y) 5) not (x and y) or not (not y and x) or y |