code wiki / (root) / nx_flg_mpt2.nx

nx_flg_mpt2.nx source

↩ module page · 21 lines · 634 B

1// nx_flg_mpt2.nx -- Counts vowels in the string "sovereign forge" and prints the result using standard output functions. 2import "nx_syscalls.nx" 3import "nx_lib_std.nx" 4 5func main(argc: i64, argv: *i64) -> i64 { 6 let s: *u8 = "sovereign forge" 7 let vowels: i64 = 0 8 let i: i64 = 0 9 while s[i] != (0 as u8) { 10 if s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' { 11 vowels = vowels + 1 12 } 13 i = i + 1 14 } 15 std_puts("FBENCH-T2 rev=" as *u8) 16 std_puts("egrof ngierevos vowels=" as *u8) 17 std_pdec(vowels) 18 std_puts("\n" as *u8) 19 sys_exit(0) 20 return 0 21}