Forum > Beginners

Unpredictable behlavior

(1/2) > >>

j@n#/:
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.

tr_escape:
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

Thaddy:
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)

tr_escape:
OK. I tried on online compiler by little bit change:

https://onlinegdb.com/SkdmNnmPV


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{                             Online Pascal Compiler.                Code, Compile, Run and Debug Pascal program online.Write your code in this editor and press "Run" button to execute it. }  program class(input,output);var  name1:string;  count:Integer;begin  count:=0;  writeln ('Enter name');  readln(name1);  writeln('your enter: ',name1);  while (name1<>'zzz') do   begin    count:=count+1;    writeln ('Enter name');    readln(name1);    writeln('your enter: ',name1);  end;  writeln('press enter for exit ');  readln;end.  
So your codes working as predicted and normally. 

Thaddy:
Why is that site running a dinosaur?

--- Code: Bash  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64Seriously?

Navigation

[0] Message Index

[#] Next page

Go to full version