On 02/19/2016 07:37 PM, Lisa wrote: > import std.stdio; > import std.math; > > int main() > { > double a, b, c, p; > > writef("Enter a: "); > scanf("%d", &a);
scanf is not a safe function. It trusts the format string and assumes that 'a' really is what the programmer told it. (For example, although 'a' is not an 'int, %d means 'int' and scanf treats it as such.)
The correct format identifier for double is %lf. You need to replace all three of with %lf.
However, you are not writing idiomatic D code. I recommend dropping C functions altogether an taking advantage of readf():
http://ddili.org/ders/d.en/input.html Ali