

Учись благодаря многочисленным ресурсам, которые есть на Docsity
Заработай баллы, помогая другим студентам, или приобретай их по тарифом Премиум
Эта страница недоступна для предварительного просмотра
Не пропусти важные части!


Контрольная работа Составьте программу, определяющую является ли вводимое с клавиатуры целое число положительным или отрицательным. Текст программы: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) private public end; var Form1: TForm1; x: longint; implementation label start,fin; begin start: write('Vvedite celoe chislo ='); readln(x); if x>0 then begin writeln('Dannoe chislo >0');goto fin; end; if x<0 then begin writeln('Dannoe chislo <0');goto fin; end; if x=0 then writeln('Dannoe chislo =0'); fin:end. Задание № 2 Напишите программу, которая запрашивает день недели и, если введённый день является субботой или воскресеньем, выдаёт сообщение: "Сегодня выходной!" Текст программы: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) private public end; var day: shortstring; Form1: TForm1; implementation begin write('Vvedite den nedeli:'); readln(day); if day='Monday' then write('Go to work'); if day='Tuesday' then write('Go to work'); if day='Wednesday' then write('Go to work'); if day='Thursday' then write('Go to work'); if day='Friday' then write('Go to work'); if day='Saturday' then write('Have some fun'); if day='Sunday' then write('Have some fun') else Writeln('Vvedeno nepravilnoe znachenie'); end. Задани № 3 Вычислите значение функции Z(x,y) при x=15,32245; y=5,32411 с максимальной точностью. Вид функции Z(x,y) соответствует заданию 1 к Лабораторной работе № 1 (по вариантам). Текст программы: unit Unit1;
interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) private { Private declarations } public { Public declarations } end; var Form1: TForm1; x,y,z: extended; implementation {$R .DFM} label vano; begin x:=15.32245;y:=5.32411; vano: if 2xx-4yyy=0 then begin writeln('Pri dannix znacheniax X i Y funkcia ne imeet reshenia'); goto vano;end; z:=(cos(x)(1-sin(y)))/(2xx-4yyy); write('Otvet :',z); end. Задание № 4 Составьте программу, которая запрашивает две строки текста и определяет включает ли первая строка текст введённый во вторую строку. Текст программы: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) private public end; var cut,text1,text2:shortstring; x,t1,t2: smallint; Form1: TForm1; implementation label fin; begin write('Vvedite 1-u stroku texta:'); readln(text1); write('Vvedite 2-u stroku texta:'); readln(text2); t1:=length(text1);t2:=length(text2); if t1<t2 then begin writeln('2 stroka > 1-oy, chto ne dopustimo'); goto fin;end; for x:=1 to t1-t2+1 do begin cut:=copy(text1,x,t2); if cut=text2 then begin writeln('stroka 1 vkluchaet v sebia stroku 2'); goto fin;end; end;