Home
О нас
Products
Services
Регистрация
Войти
Поиск
wWlSw
@wWlSw
July 2022
1
4
Report
Помогите написать программу построения графика функции в графическом режиме.Y=cos(x^2). Pascal.
Please enter comments
Please enter your name.
Please enter the correct email address.
Agree to
terms of service
You must agree before submitting.
Send
Answers & Comments
ShirokovP
Verified answer
Uses
graphABC;
const
W = 800;
H = 500;
function F(x: real): real;
begin
F := cos(x * x);
end;
var
x0, y0, x, y, xLeft, yLeft, xRight, yRight, n: integer;
a, b, fmin, fmax, x1, y1, mx, my, dx, dy, num: real;
i: byte;
s: string;
begin
SetWindowSize(W, H);
xLeft := 50;
yLeft := 50;
xRight := W - 50;
yRight := H - 50;
a := -2;b := 6;dx := 0.5;
fmin := -10;fmax := 20;dy := 2;
mx := (xRight - xLeft) / (b - a);
my := (yRight - yLeft) / (fmax - fmin);
x0 := trunc(abs(a) * mx) + xLeft;
y0 := yRight - trunc(abs(fmin) * my);
line(xLeft, y0, xRight + 10, y0);
line(x0, yLeft - 10, x0, yRight);
SetFontSize(12);
SetFontColor(clBlue);
TextOut(xRight + 20, y0 - 15, 'X');
TextOut(x0 - 10, yLeft - 30, 'Y');
SetFontSize(8);
SetFontColor(clRed);
n := round((b - a) / dx) + 1;
for i := 1 to n do
begin
num := a + (i - 1) * dx;
x := xLeft + trunc(mx * (num - a));
Line(x, y0 - 3, x, y0 + 3);
str(Num:0:1, s);
if abs(num) > 1E-15 then
TextOut(x - TextWidth(s) div 2, y0 + 10, s)
end;
n := round((fmax - fmin) / dy) + 1;
for i := 1 to n do
begin
num := fMin + (i - 1) * dy;
y := yRight - trunc(my * (num - fmin));
Line(x0 - 3, y, x0 + 3, y);
str(num:0:0, s);
if abs(num) > 1E-15 then
TextOut(x0 + 7, y - TextHeight(s) div 2, s)
end;
TextOut(x0 - 10, y0 + 10, '0');
x1 := a;
while x1 <= b do
begin
y1 := F(x1);
x := x0 + round(x1 * mx);
y := y0 - round(y1 * my);
if (y >= yLeft) and (y <= yRight) then SetPixel(x, y, clGreen);
x1 := x1 + 0.001
end
end.
2 votes
Thanks 2
рекомендуемые вопросы
rarrrrrrrr
August 2022 | 0 Ответы
o chem dolzhny pozabotitsya v pervuyu ochered vzroslye pri organizacionnom vyvoze n
danilarsentev
August 2022 | 0 Ответы
est dva stanka na kotoryh vypuskayut odinakovye zapchasti odin proizvodit a zapcha
myachina8
August 2022 | 0 Ответы
najti po grafiku otnoshenie v3v1 v otvetah napisano 9 no nuzhno reshenie
ydpmn7cn6w
August 2022 | 0 Ответы
Choose the correct preposition: 1.I am fond (out,of,from) literature. 2.where ar...
millermilena658
August 2022 | 0 Ответы
opredelite kak sozdavalas i kto sozdaval arabskoe gosudarstvo v kracii
MrZooM222
August 2022 | 0 Ответы
ch ajtmanov v rasskaze krasnoe yabloko ispolzuet metod rasskaz v rasskaze opi
timobila47
August 2022 | 0 Ответы
kakovo bylo naznachenie kazhdoj iz chastej vizantijskogo hrama pomogite pozhalujsta
ivanyyaremkiv
August 2022 | 0 Ответы
moment. 6....
pozhalujsta8b98a56c0152a07b8f4cbcd89aa2f01e 97513
sarvinozwakirjanova
August 2022 | 0 Ответы
pomogite pozhalusto pzha519d7eb8246a08ab0df06cc59e9dedb 6631
×
Report "Помогите написать программу построения графика функции в графическом режиме.Y=co..."
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Helpful Links
О нас
Политика конфиденциальности
Правила и условия
Copyright
Контакты
Helpful Social
Get monthly updates
Submit
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
UsesgraphABC;
const
W = 800;
H = 500;
function F(x: real): real;
begin
F := cos(x * x);
end;
var
x0, y0, x, y, xLeft, yLeft, xRight, yRight, n: integer;
a, b, fmin, fmax, x1, y1, mx, my, dx, dy, num: real;
i: byte;
s: string;
begin
SetWindowSize(W, H);
xLeft := 50;
yLeft := 50;
xRight := W - 50;
yRight := H - 50;
a := -2;b := 6;dx := 0.5;
fmin := -10;fmax := 20;dy := 2;
mx := (xRight - xLeft) / (b - a);
my := (yRight - yLeft) / (fmax - fmin);
x0 := trunc(abs(a) * mx) + xLeft;
y0 := yRight - trunc(abs(fmin) * my);
line(xLeft, y0, xRight + 10, y0);
line(x0, yLeft - 10, x0, yRight);
SetFontSize(12);
SetFontColor(clBlue);
TextOut(xRight + 20, y0 - 15, 'X');
TextOut(x0 - 10, yLeft - 30, 'Y');
SetFontSize(8);
SetFontColor(clRed);
n := round((b - a) / dx) + 1;
for i := 1 to n do
begin
num := a + (i - 1) * dx;
x := xLeft + trunc(mx * (num - a));
Line(x, y0 - 3, x, y0 + 3);
str(Num:0:1, s);
if abs(num) > 1E-15 then
TextOut(x - TextWidth(s) div 2, y0 + 10, s)
end;
n := round((fmax - fmin) / dy) + 1;
for i := 1 to n do
begin
num := fMin + (i - 1) * dy;
y := yRight - trunc(my * (num - fmin));
Line(x0 - 3, y, x0 + 3, y);
str(num:0:0, s);
if abs(num) > 1E-15 then
TextOut(x0 + 7, y - TextHeight(s) div 2, s)
end;
TextOut(x0 - 10, y0 + 10, '0');
x1 := a;
while x1 <= b do
begin
y1 := F(x1);
x := x0 + round(x1 * mx);
y := y0 - round(y1 * my);
if (y >= yLeft) and (y <= yRight) then SetPixel(x, y, clGreen);
x1 := x1 + 0.001
end
end.