Skip to content

Компилятор процедурного языка программирования

Notifications You must be signed in to change notification settings

vstdio/Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

compiler-60min

Пример кода на языке

func abs(x: Float) -> Float:
{
	if (x < 0)
	{
		return -x;
	}
	return x;
}

func GetSquareRootNewtonMethod(x: Float) -> Float:
{
	var guess: Float = x / 2;
	var next: Float = (guess + x / guess) / 2;
	while (abs(next - guess) >= 0.01)
	{
		guess = next;
		next = (guess + x / guess) / 2;
	}
	return next;
}

func main(argc: Int, argv: Array<String>):
{
	var value: Float = 21.0;
	print("Enter float value: ");
	scan("%lf", value);
	print("sqrt(%f) = %f", value, GetSquareRootNewtonMethod(value));
}

About

Компилятор процедурного языка программирования

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published