0.1.1 • Published 9 months ago
stdio.h v0.1.1
stdio.h for nodejs
just hobby project to create input output for nodejs
Installing
Install with NPM
npm install stdio.h
or install with Yarn
yarn add stdio.h
Example
printf
import { int, printf } from "stdio.h";
let n1: int = 20;
let n2: int = 30;
printf("%d+%d = %d", n1, n2, n1 + n2);
ife
import { int, printf, ife } from "stdio.h";
ife(
20 > 10,
() => printf("true"),
() => printf("false")
);
swap
import { _int, printf, swap } from "stdio.h";
let i: _int = [20];
let j: _int = [150];
printf("i = %d, j = %d", i, j);
swap(i, j);
printf("i = %d, j = %d", i, j);
// output
// i = 20, j = 150
// i = 150, j = 20
sprintf
import { _str, printf, sprintf } from "stdio.h";
let text: _str = [''];
sprintf(text, "result = %d", 10) ;
printf("%s", text);
// output
// result = 10