Fix typos, add EXIT_WHEN_DONE variable, change formatting

This commit is contained in:
sam-astro 2022-05-27 08:17:57 -04:00 committed by GitHub
parent 89392bc34d
commit 5e89ac5884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,13 +4,17 @@ using namespace std;
std::string ZSContents = R"( std::string ZSContents = R"(
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// ↓ DEFAULT BUILTIN ↓ // BUILTIN
////////////////////////////////////////////////////////////////////////////////
// Default variables, can be overwritten // Default variables, can be overwritten
// if re-initialized or changed // if re-initialized or changed
float PI = 3.14159265358979323846264338 float PI = 3.14159265358979323846264338
float EulersNumber = 2.71828183 float EulersNumber = 2.71828183
// This variable tells the interpreter if it should close the console window when the program has finished running.
bool EXIT_WHEN_DONE = true
// Trigonometric function Sin // Trigonometric function Sin
func Sin(input) func Sin(input)
{ {
@ -148,8 +152,10 @@ func GetKey(keyName)
//} //}
//////////////////////////////////////////////////////
// ↓ MADE BY KAPUTCHINO ↓ ////////////////////////////
// ↓ MADE BY KAPUTCHINO ↓ //
////////////////////////////
// Return the number of combinations // Return the number of combinations
func Comb(n, r) func Comb(n, r)
@ -191,17 +197,17 @@ func Perm(n, r)
{ {
if n < 0 if n < 0
{ {
ZS.System.PrintLine("n muss be superior or equal to 0") ZS.System.PrintLine("n must be superior or equal to 0")
return -1 return -1
} }
if r < 0 if r < 0
{ {
ZS.System.PrintLine("r muss be superior or equal to 0") ZS.System.PrintLine("r must be superior or equal to 0")
return -1 return -1
} }
if r > n if r > n
{ {
ZS.System.PrintLine("r muss be inferor or equal to n") ZS.System.PrintLine("r must be inferior or equal to n")
return -1 return -1
} }
return Fac(n) / Fac(n - r) return Fac(n) / Fac(n - r)