The code:
const std = @import("std");
const print = std.debug.print;
const TITLE = "Simple-Calculator";
fn getNumberInput(statement: []const u8) ![]u8 {
var input: [1024]u8 = undefined;
print("{s} ", .{statement});
const result = try std.io.getStdIn().reader().readUntilDelimiter(&input, '\n');
return result;
}
pub fn main() !void {
print("================================\n-|Welcome To {s}|-\n================================\n", .{TITLE});
const firstNumber = try getNumberInput("Enter your first number:");
print("You entered: {s}!\n", .{firstNumber});
}
The output:
================================
-|Welcome To Simple-Calculator|-
================================
Enter your first number: 88
You entered: ��!