📄 native.jc
字号:
/*
* import stdlib
*
* This is a rudimentary native typelib that implements some useful global functions.
* To use a native typelib, it must be registered to the JIL virtual machine.
* Then we can conveniently import the functions implemented in the typelib here.
*/
import stdlib;
import math;
/*
* function main
* test native typelibs
*/
function string main()
{
test_stdlib();
return "";
}
/*
* function test_stdlib
* test static functions of the native typelib stdlib
*/
function test_stdlib()
{
stdlib::Print( "Hello, this is test_stdlib()!\n\n" );
stdlib::Printf( "Rand() returns %g\n", stdlib::Rand() );
stdlib::Printf( "GetTicks() returns %d\n", stdlib::GetTicks() );
stdlib::Printf( "pow(2, 3) returns %g\n", math::pow(2,3) );
stdlib::Print( "\nPlease enter something: " );
string input = stdlib::GetString();
stdlib::Printf( "You entered: '%s'\n", input );
stdlib::Print ( "Please enter a number: ");
input = stdlib::GetString();
stdlib::Printf( "Your input as long: %d\n", stdlib::Atol(input) );
stdlib::Printf( "Your input as float: %g\n", stdlib::Atof(input) );
stdlib::Print( "\nBye!\n\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -