I can not display the function, all the time something is wrong.

Here is my code, marked the line with the text with the error:

var x,y: real; n:byte; begin writeln('ввести x'); readln(x); if x<=-05 then begin y:=cos(sqrt(exp(yln(1/5)(abs(x+ln(abs(x))))))); // <<<--- Ожидалось имя процедуры или функции n:=1 end else if(x>-0,5)and(x<=0,5)then begin y:=cos(exp(abs(x+ln(abs(x))))); n:=2 end else begin y:=exp((yln(1/3)))(exp(x))(sqrt(x+1))-pi; n:=3 end; writeln('x=',x:6:2,'y=',y:6:2,'n=',n:3); end. 
  • Give at least some code, albeit with errors - we will help there. - Alex Chermenin
  • Add code to the question, as text, pliz. - Kromster
  • "Something is not right all the time" - this is always the case when you study programming .... Specify what is wrong with you now, and transfer the program text to the question, please. - 4per
  • 2
    Questions asking for help with debugging (“why does this code not work?”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question. Questions without an explicit description of the problem are useless for other visitors. - Kromster
  • one
    @Qwertiy I did not minus. But I would put the flag for closing, for the fact that the problem is not indicated. Now the vehicle at least showed it with a screen, I don’t check the box. - Kromster

2 answers 2

In almost all programming languages, the multiplication sign cannot be omitted. And in the above code in its place there are even no spaces.

In all places where multiplication is meant, there must be a * .

The second error is that a comma is used in the numbers as a fractional separator: 0,5 , and there must be a period: 0.5 .

  • in tungsten alpha and math can be. If the question mark is exactly what it means. - pavel
  • @pavel, yes, it meant that I could not remember the language in which I could. - Qwertiy

We begin to describe the first formula:

1-1) y := x*x is x²

1-2) y := x*x + sqr() is the square for the tangent

1-3) y := x*x + sqr( sin() / cos() ) is the actual tangent, which is not in pascal

1-4) in sin and cos brackets you need to add (x+pi)/2

As a result, the first formula turned out to be:

y := x*x + sqr( sin((x + pi) / 2) / cos((x + pi) / 2) )

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~

Second:

2-1) y := cos() is understandable so

2-2) y := cos( exp( ln() / 5)) - fifth degree root

2-2) y := cos( exp( ln( abs(x + ln(abs(x))) ) / 5)) - it’s just

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~

Third:

3-1) y := exp( ln() / 3) - the root of the third degree

3-2) y := exp( ln( x + exp(x) * sqrt(x + 1) - pi ) / 3) - add only what is under the root

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~

That's the whole program:

 var x,y: real; begin writeln('ввести x'); readln(x); if x <= -0.5 then y := x*x + sqr( sin((x + pi) / 2) / cos((x + pi) / 2) ) else if x > +0.5 then y := exp( ln(x + exp(x) * sqrt(x + 1) - pi) / 3 ) else { -0.5 < x <= +0.5 } y := cos( exp(ln( abs(x + ln(abs(x))) ) / 5) ); writeln('y(', x:6:2, ') = ', y:6:2); end.