2 param Problems

Derek Parnell derek at psych.ward
Sun Nov 30 11:48:34 PST 2008


On Sun, 30 Nov 2008 10:58:50 -0800, Walter Bright wrote:

> Fabian Claßen wrote:
>> 	double zahl = add(1, 5.6, 41, "Hello");
>> 	writefln("%d", zahl);
> [...]
>> 
>> When I try to run this codes there is printed following message in the cmd:
>> 
>> Error: std.format floating
>> 
>> Please help me. I have no idea.
> 
> %d is for integral arguments, not floating point ones. Try %s.

Also note that you would use '%f' or '%g' if you wanted to force runtime
type checking on your arguments. The '%s' does not force typechecking as it
converts whatever argument it is given to a string. You would also use "%f"
if you needed finer formatting details, such as "%5.2f" etc ...

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list