Hack Forums
[Shell] [PowerShell] Shitty Square Root Finder - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] [PowerShell] Shitty Square Root Finder (/showthread.php?tid=5692438)



[PowerShell] Shitty Square Root Finder - Travelers - Aug 11, 2017

Hey everyone.

Today I coded the Shitty Square Root Finder. I'm taking an intro to Physics class and for some reason I decided to make. Not really sure how the two correlate, but I was studying for that when I made this.

Code
# all this does is find the square root. That's it

# change title
$host.ui.RawUI.WindowTitle = "Shitty Square Root Finder"
# define variables
# get input from user
Write-Host "Hello, and welcome to the shitty square root calculator!"
$number = Read-host -Prompt "What number do you want to find the square root of: "
# use system.math to solve problems great than basi arithmetic
# use SQRT to find square root
[math]::Sqrt($number)

We use the System.Math class to pass advanced mathematical operations through PowerShell. PowerShell itself can handle arithmetic operations, but anything more advanced will require the Math Class. Here is the link to the technical documentation from Microsoft, for those interested.

https://msdn.microsoft.com/en-us/library/system.math(v=vs.110).aspx