092-098 completed

This commit is contained in:
Andrew Scott 2024-06-19 12:19:46 -04:00
parent 0c1643b722
commit e06cf45604
Signed by: a
GPG key ID: 7CD5A5977E4931C1
7 changed files with 7 additions and 7 deletions

View file

@ -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();
}
}

View file

@ -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});

View file

@ -26,7 +26,7 @@ const std = @import("std");
const c = @cImport({
// What do we need here?
???
@cInclude("math.h");
});
pub fn main() !void {

View file

@ -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.

View file

@ -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: ", .{});

View file

@ -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 });
}

View file

@ -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;
}