075-079 completed

This commit is contained in:
Andrew Scott 2024-06-12 06:54:01 -04:00
parent f86b769f62
commit 0651d71c47
Signed by: a
GPG key ID: 7CD5A5977E4931C1
5 changed files with 13 additions and 9 deletions

View file

@ -49,7 +49,11 @@ const Path = struct {
//
// Please fill in the body of this function!
fn makePath(from: *Place, to: *Place, dist: u8) Path {
return Path{
.from = from,
.to = to,
.dist = dist,
};
}
// Using our new function, these path definitions take up considerably less

View file

@ -82,7 +82,7 @@ fn printSequence(my_seq: anytype) void {
print("Array:", .{});
// Loop through the items in my_seq.
for (???) |s| {
for (my_seq) |s| {
print("{}", .{s});
}
},
@ -94,7 +94,7 @@ fn printSequence(my_seq: anytype) void {
// Loop through the items in my_seq until we hit the
// sentinel value.
var i: usize = 0;
while (??? != my_sentinel) {
while (my_seq[i] != my_sentinel) {
print("{}", .{my_seq[i]});
i += 1;
}

View file

@ -60,7 +60,7 @@ pub fn main() void {
// length... You've actually solved this problem before!
//
// Here's a big hint: do you remember how to take a slice?
const printable = ???;
const printable = foo.data[0..11];
print("{s}\n", .{printable});
}

View file

@ -21,7 +21,7 @@ pub fn main() void {
const data: [*]const u8 = "Weird Data!";
// Please cast 'data' to 'printable':
const printable: [*:0]const u8 = ???;
const printable: [*:0]const u8 = @ptrCast(data);
print("{s}\n", .{printable});
}

View file

@ -20,11 +20,11 @@
const print = @import("std").debug.print;
pub fn main() void {
const 55_cows: i32 = 55;
const isn't true: bool = false;
const @"55_cows": i32 = 55;
const @"isn't true": bool = false;
print("Sweet freedom: {}, {}.\n", .{
55_cows,
isn't true,
@"55_cows",
@"isn't true",
});
}