Recent

Author Topic: Unpredictable behlavior  (Read 2121 times)

j@n#/

  • Newbie
  • Posts: 1
Unpredictable behlavior
« on: March 11, 2019, 06:03:15 am »
Sorry, didn't see .txt in the attachment list.

Why is this program behaving weirdly. Free Pascal 3.0.4

When the program runs it displays Enter name. Name is entered and press return, the cursor returns to the beginning of the name just entered, it doesn't go to the next line.

If you then press enter, it deletes the name and displays Enter name again and seems to work okay but when the condition zzz is entered, it needs to be entered at least twice before the loop ends.

« Last Edit: March 11, 2019, 08:21:19 pm by j@n#/ »

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: Unpredictable behlavior
« Reply #1 on: March 11, 2019, 06:08:07 am »
Could you please share your codes as text please?

Because picture isn't copyable to fpc editor :)

Also this links can help you:

http://wiki.freepascal.org/Console_Mode_Pascal

http://wiki.freepascal.org/Command_line_parameters_and_environment_variables
« Last Edit: March 11, 2019, 08:26:27 am by tr_escape »

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Unpredictable behlavior
« Reply #2 on: March 11, 2019, 09:06:09 am »
We can only see that the program is behaving weird because of the BSOD-blue color... ;D

Plz add code indeed (a full, small, compilable example is preferred)
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: Unpredictable behlavior
« Reply #3 on: March 11, 2019, 11:12:04 am »
OK. I tried on online compiler by little bit change:

https://onlinegdb.com/SkdmNnmPV

Code: Pascal  [Select][+][-]
  1. {
  2.  
  3.                             Online Pascal Compiler.
  4.                 Code, Compile, Run and Debug Pascal program online.
  5. Write your code in this editor and press "Run" button to execute it.
  6.  
  7. }
  8.  
  9.  
  10. program class(input,output);
  11. var
  12.   name1:string;
  13.   count:Integer;
  14. begin
  15.   count:=0;
  16.   writeln ('Enter name');
  17.   readln(name1);
  18.   writeln('your enter: ',name1);
  19.   while (name1<>'zzz') do
  20.   begin
  21.     count:=count+1;
  22.     writeln ('Enter name');
  23.     readln(name1);
  24.     writeln('your enter: ',name1);
  25.   end;
  26.   writeln('press enter for exit ');
  27.   readln;
  28. end.
  29.  
  30.  

So your codes working as predicted and normally. 


Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Unpredictable behlavior
« Reply #4 on: March 11, 2019, 11:32:07 am »
Why is that site running a dinosaur?
Code: Bash  [Select][+][-]
  1. Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64
Seriously?
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: Unpredictable behlavior
« Reply #5 on: March 11, 2019, 12:02:47 pm »
Why is that site running a dinosaur?
Code: Bash  [Select][+][-]
  1. Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64
Seriously?

Actually I found first found by google,
There some updated sites but most interactive is onlinegdb site.


 

TinyPortal © 2005-2018