简单的D程序输出顺序错误 [英] Simple D program Output order is wrong

查看:84
本文介绍了简单的D程序输出顺序错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习一种叫做 D的新语言,但是在尝试编写一个简单程序时遇到了问题

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?

我认为这只是DDT问题,当我在命令提示符下运行程序时,它的工作正常

I think its just the DDT problem, when i run the program in command prompt its working fine

推荐答案

输出到Eclipse的缓冲区将由较大的数据块而不是行输出。要强制显示输出,请在请求输入之前插入对 stdout.flush(); 的调用,以确保在需要时显示它。

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.

另请参阅:只有在程序完成后,Eclipse控制台才会写入输出

这篇关于简单的D程序输出顺序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆