Resistance calculator: Difference between revisions
Content added Content deleted
Recombinant (talk | contribs) (→{{header|Zig}}: Correct postfix/infix order) |
Recombinant (talk | contribs) m (→{{header|Zig}}: writer.print() is void (no return value)) |
||
Line 1,495: | Line 1,495: | ||
pub fn report(self: *Node, allocator: Allocator, writer: anytype, level: []const u8) !void { |
pub fn report(self: *Node, allocator: Allocator, writer: anytype, level: []const u8) !void { |
||
if (self.voltage) |voltage| { |
if (self.voltage) |voltage| { |
||
try writer.print("{d:8.3} {d:8.3} {d:8.3} {d:8.3} {s}{c}\n", .{ |
|||
self.res(), voltage, self.current(), |
self.res(), voltage, self.current(), |
||
self.effect(), level, self.node_type.repr(), |
self.effect(), level, self.node_type.repr(), |
||
Line 1,547: | Line 1,547: | ||
pub fn calculate(allocator: Allocator, writer: anytype, voltage: f32, tokens: []PostfixToken) !*Node { |
pub fn calculate(allocator: Allocator, writer: anytype, voltage: f32, tokens: []PostfixToken) !*Node { |
||
try writer.print(" Ohm Volt Ampere Watt Network tree\n", .{}); |
|||
var node = try build(allocator, tokens); |
var node = try build(allocator, tokens); |