Recent

Author Topic: Circle - Syntax Error?  (Read 1855 times)

habop73

  • Newbie
  • Posts: 2
Circle - Syntax Error?
« on: February 04, 2023, 07:15:18 pm »
I want to draw a Circle with die command-line "Circle (X, Y, Radius);". When compiling the program this line produces the following Syntax Error: "." expected, but "(" found. Why?

Here ist the complete Programm-Code:

PROGRAM Circle;
USES Graph;
VAR
  gd, gm: Integer;

BEGIN
  gd := Detect;
  InitGraph(gd, gm, '');
  if GraphResult <> grOk then
  begin
    Writeln('Fehler beim Initialisieren des Grafikmodus.');
    Halt(1);
  end;
  Circle (100,100,50);
  readln;
  CloseGraph;
END.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2007
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Circle - Syntax Error?
« Reply #1 on: February 04, 2023, 07:23:16 pm »
I just change Integer to SmallInt and it works like it should.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

bytebites

  • Hero Member
  • *****
  • Posts: 632
Re: Circle - Syntax Error?
« Reply #2 on: February 04, 2023, 07:35:33 pm »
Change program name.

Roland57

  • Sr. Member
  • ****
  • Posts: 419
    • msegui.net
Re: Circle - Syntax Error?
« Reply #3 on: February 04, 2023, 08:08:16 pm »
And use appropriate tags (button #) when you post code, bitte:)
« Last Edit: February 04, 2023, 08:12:14 pm by Roland57 »
My projects are on Gitlab and on Codeberg.

circular

  • Hero Member
  • *****
  • Posts: 4193
    • Personal webpage
Re: Circle - Syntax Error?
« Reply #4 on: February 04, 2023, 10:28:53 pm »
Maybe the name of the program interferes and it thinks you want something in the program Circle. I suggest to rename the program (at the top of the file).
Conscience is the debugger of the mind

TRon

  • Hero Member
  • *****
  • Posts: 2432
Re: Circle - Syntax Error?
« Reply #5 on: February 05, 2023, 03:37:57 am »
Change program name.
... I suggest to rename the program (at the top of the file).

But but but.. but ... but I really want my program to be named circle  :D

Code: Pascal  [Select][+][-]
  1. Graph.Circle(100,100,50);
  2.  
« Last Edit: February 05, 2023, 03:42:13 am by TRon »

Bogen85

  • Hero Member
  • *****
  • Posts: 595
Re: Circle - Syntax Error?
« Reply #6 on: February 05, 2023, 03:49:10 am »
But but but.. but ... but I really want my program to be named circle  :D
Code: Pascal  [Select][+][-]
  1. Graph.Circle(100,100,50);
  2.  


This forum need a reaction area for each post...


circular

  • Hero Member
  • *****
  • Posts: 4193
    • Personal webpage
Re: Circle - Syntax Error?
« Reply #7 on: February 05, 2023, 08:25:01 am »
 :D
Conscience is the debugger of the mind

loaded

  • Hero Member
  • *****
  • Posts: 824
Re: Circle - Syntax Error?
« Reply #8 on: February 05, 2023, 10:05:54 am »
In my experience, the closest polygon visually to the circle is the 41 diagonal.
Let this be an example from me.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3. center:TPoint;
  4. radius:double;
  5. diagonal:array of TPoint;
  6. i:integer;
  7. begin
  8.     center:=Point(100,100);
  9.     radius:=50;
  10.     SetLength(diagonal,41);
  11.     for i:=0 to High(diagonal) do
  12.     begin
  13.     diagonal[i]:=point(
  14.     trunc(center.X +radius * sin(i*(2*pi)/High(diagonal))),
  15.     trunc(center.Y +radius * cos(i*(2*pi)/High(diagonal))));
  16.     end;
  17.     canvas.Polyline(diagonal);
  18. end;
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

TRon

  • Hero Member
  • *****
  • Posts: 2432
Re: Circle - Syntax Error?
« Reply #9 on: February 06, 2023, 05:55:11 am »
This forum need a reaction area for each post...
:D

Thank you Bogen85 for your faith in my answer  :-[

You have a point though in that things could be improved a bit.

Topic enhancements:
Topic Solved
Topic Solved Mod
Topic Solved
rateTopic
Most Popular Topic Today
Tagging System For Topics

Post enhancement:
Posts I liked
Like Posts
Good Post/Bad Post Mod
Best Answer
Best Answer

Human behaviour:
Post Karma

For some bookkeeping
Message Bookmarks
Topics Created And Participated In

For some fun:
Blabberizer

But, I haven't ran a SMF forum in ages (I have no idea about for which version of SMF the posted links are or if they work as intended or not). Also, I can perfectly well understand that adding more features is just a maintenance nightmare (waiting to happen).

Not to mention that using some kind of rewarding system (karma/likes etc) probably will be abused by those that shall not be named  :)

edit: sorry bookmarks seem to be present already.

habop73

  • Newbie
  • Posts: 2
Re: Circle - Syntax Error?
« Reply #10 on: February 07, 2023, 11:50:48 am »
Thanks for the anserws. That all worked fine!

Bogen85

  • Hero Member
  • *****
  • Posts: 595
Re: Circle - Syntax Error?
« Reply #11 on: February 07, 2023, 02:03:29 pm »
But, I haven't ran a SMF forum in ages (I have no idea about for which version of SMF the posted links are or if they work as intended or not). Also, I can perfectly well understand that adding more features is just a maintenance nightmare (waiting to happen).

I always kind of thought the particular look was purposeful, looking like something 15-20 years old and not using markdown was to reflect the "age/maturity" of the project...

Not to mention that using some kind of rewarding system (karma/likes etc) probably will be abused by those that shall not be named  :)

Heh, well, as long as the number doing this low, and the their vote count subject to similar karma, that could work.

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: Circle - Syntax Error?
« Reply #12 on: February 07, 2023, 02:16:01 pm »

You have a point though in that things could be improved a bit.

Post enhancement:
Posts I liked
Like Posts
Good Post/Bad Post Mod
Best Answer
Best Answer

Human behaviour:
Post Karma

Ho no, please, not those.
Imho, the charm of Lazarus forum it is precisely that there are not all these sorts of medals which give a hierarchy.
The number of posts is enough.
« Last Edit: February 07, 2023, 02:18:18 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

TRon

  • Hero Member
  • *****
  • Posts: 2432
Re: Circle - Syntax Error?
« Reply #13 on: February 07, 2023, 02:31:32 pm »
Imho, the charm of Lazarus forum it is precisely that there are not all these sorts of medals which give a hierarchy.
I have the same problems/reservations with regards to having some sort of hierarchy.

However, I also believe it can be very helpful to know which answer was the most appropriate. Whether  that is by TS or other more experienced members. I deem the best answer mod one of the better mods in that regards.

Some threads are full of non-sense answers or answers that are repeated (sometimes even weeks later). Sometimes it is hard to filter out all this crap.

Don't forget that some people that drop in from time to time truly believe that post-count (Hero Member, Junior member etc) tells something about the quality of the answers (which is just rubbish).

btw: if this is going to be a full discussion then it might perhaps better to split off this discussion in its own thread. On the other hand I do not believe forum owner have any intention to add additional mods (reason as already provided). In which case there is no need for discussion  :)
« Last Edit: February 07, 2023, 02:39:22 pm by TRon »

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: Circle - Syntax Error?
« Reply #14 on: February 07, 2023, 02:39:28 pm »
However, I also believe it can be very helpful to know which answer was the most appropriate. Whether  that is by TS or other more experienced members. I deem the best answer mod one of the better mods in that regards.

Ok, and who will decide for the best answer: ChatGPT, Bard or me?  :-\
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018