# Lazarus

## Free Pascal => Beginners => Topic started by: slava33 on June 02, 2019, 07:43:57 pm

Title: Program for search extremum
Post by: slava33 on June 02, 2019, 07:43:57 pm
Help me make a program "Search for extremum" by the block diagram
Title: Re: Program for search extremum
Post by: marcov on June 02, 2019, 08:23:11 pm
So how far did you get? Where is the code of your tries?

We help people with problems, but we don't write complete assignment code.
Title: Re: Program for search extremum
Post by: jamie on June 02, 2019, 11:08:53 pm
Lets see, it's Sunday here and we have a noob asking to get his home work done..

I bet the head is pounding from all the party activities over the weekend..

Good luck with your endeavor. :)
Title: Re: Program for search extremum
Post by: VTwin on June 02, 2019, 11:43:18 pm
Lets see, it's Sunday here and we have a noob asking to get his home work done..

I bet the head is pounding from all the party activities over the weekend..

Good luck with your endeavor. :)

:D
Title: Re: Program for search extremum
Post by: slava33 on June 02, 2019, 11:49:19 pm
Wow, I thought foreign forums would be more loyal. If you had seen how badly they teach in Russia... Everything has already been decided on the Russian forum and without further ado. The topic is closed.  :P

program Project1;
label
a1,a2;

function f(xx: double):double;
begin
f:= xx;
end;

var
A,B,H,E,n: double;
x,x1,x0: double;
y,y1: double;
begin
writeln('Введите значение аргумента А:');
writeln('Введите значение аргумента B:');
writeln('Введите значение аргумента E:');
writeln('Введите значение аргумента n:');
H:= (B - A)/n;
a1:
x:= A;
a2:
y:= f(x);
x1:= x + H;
y1:= f(x1);
if y < y1 then
begin
x:= x + H;
if x <= B - H  then
goto a2
else
writeln('Экстремума нет:');
end
else
begin
if y1 - y <= E then
begin
x0:=(B - 2*H)/2;
writeln('Результат вычислений:');
writeln('x0 = ',x0:0:4,'; f(x) = ',f(x):0:4,'; E = ',E:0:4,'; H = ',H:0:4);
end
else
begin
H:= H/4;
A:= x1 - 2*H;
B:= x1;
goto a1;
end;
end;
end.
Title: Re: Program for search extremum
Post by: lucamar on June 03, 2019, 12:44:39 am
Wow, I thought foreign forums would be more loyal.

We are "loyal". What we are not is pansies. We don't come here to make your home-work (or whatever it is) for you, but to help you do it yourself. Why? Because otherwise you'll not learn.

If you had come with a failing program (even a bad one!), we would have probably teared it apart telling you where and, more important why it failed and showing you ways to make it better. Look around in this forum if you dont believe me.

Instead, you give us just a diagram and ask for the corresponding program. Come on! Coding from a flowchart is (still) a basic technique you should learn to master, much more with such an easy to translate chart.

The folks in the Russian forum haven't made you any favor.
Title: Re: Program for search extremum
Post by: sash on June 03, 2019, 09:54:53 am
Wow, I thought foreign forums would be more loyal. If you had seen how badly they teach in Russia

First, what I really see is that instead of getting learned you're trying to cheat with your homework.
Second, I live there. And I studied when there were no internet, not even modems, only printed books. And we had a "machine time schedule" for a program to be typed-in and run.