mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-21 21:53:11 -05:00
092-098 completed
This commit is contained in:
parent
0c1643b722
commit
e06cf45604
7 changed files with 7 additions and 7 deletions
|
@ -106,7 +106,7 @@ pub fn main() !void {
|
|||
for (my_insects) |insect| {
|
||||
// Almost done! We want to print() each insect with a
|
||||
// single method call here.
|
||||
???
|
||||
insect.print();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ pub fn main() void {
|
|||
//
|
||||
// In this exercise we use 'write' to output 17 chars,
|
||||
// but something is still missing...
|
||||
const c_res = write(2, "Hello C from Zig!", 17);
|
||||
const c_res = c.write(2, "Hello C from Zig!", 17);
|
||||
|
||||
// let's see what the result from C is:
|
||||
std.debug.print(" - C result is {d} chars written.\n", .{c_res});
|
||||
|
|
|
@ -26,7 +26,7 @@ const std = @import("std");
|
|||
|
||||
const c = @cImport({
|
||||
// What do we need here?
|
||||
???
|
||||
@cInclude("math.h");
|
||||
});
|
||||
|
||||
pub fn main() !void {
|
||||
|
|
|
@ -54,7 +54,7 @@ pub fn main() void {
|
|||
|
||||
// I want to print every number between 1 and 20 that is NOT
|
||||
// divisible by 3 or 5.
|
||||
for (???) |n| {
|
||||
for (0..21) |n| {
|
||||
|
||||
// The '%' symbol is the "modulo" operator and it
|
||||
// returns the remainder after division.
|
||||
|
|
|
@ -64,7 +64,7 @@ pub fn main() !void {
|
|||
const allocator = arena.allocator();
|
||||
|
||||
// allocate memory for this array
|
||||
const avg: []f64 = ???;
|
||||
const avg: []f64 = try allocator.alloc(f64, arr.len);
|
||||
|
||||
runningAverage(arr, avg);
|
||||
std.debug.print("Running Average: ", .{});
|
||||
|
|
|
@ -80,7 +80,7 @@ pub fn main() !void {
|
|||
y ^= x;
|
||||
|
||||
// What must be written here?
|
||||
???;
|
||||
x ^= y;
|
||||
|
||||
print("x = {d}; y = {d}\n", .{ x, y });
|
||||
}
|
||||
|
|
|
@ -60,5 +60,5 @@ fn isPangram(str: []const u8) bool {
|
|||
// and if so, we know the given string is a pangram
|
||||
//
|
||||
// but what do we have to compare?
|
||||
return bits == 0x..???;
|
||||
return bits == 0x3ffffff;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue