问题
I am learning a new language called "D" but i have a problem when trying to write a simple program
import std.stdio;
void main()
{
double gradeOne;
writeln("Please enter the First Test Grade: ");
readf(" s", &gradeOne);
}
Why does my program ask me for the input first before the output message?
I think its just the DDT problem, when i run the program in command prompt its working fine
回答1:
Output to Eclipse buffers output by larger data blocks rather than lines. To force output to appear, insert calls to stdout.flush();
before asking for input to ensure it shows up when you want it.
See also: Eclipse console writes output only after the program has finished
来源:https://stackoverflow.com/questions/19238432/simple-d-program-output-order-is-wrong