Jump to content

Simple Calculator By Trojan


Trojan55
 Share

Recommended Posts

Hello guys, today i'm gonna share a calculator :D

So Now It's Better i just decided to make it better :)

; Made By Trojan55
; NEW VERSION CAME OUT!
MsgBox(0,"Calculatoz","Hello "&@Username)
$n1 = InputBox("Calculatoz","First Number")
$nm = InputBox("Calculatoz","Mark +,-,x...")
$n2 = InputBox("Calculatoz","Second Number")
If $nm = "+" then MsgBox(0,"Calculatoz","Result : "&Execute($n1+$n2))
If $nm = "-" then MsgBox(0,"Calculatoz","Result : "&Execute($n1-$n2))
If $nm = "x" then MsgBox(0,"Calculatoz","Result : "&Execute($n1*$n2))
If $nm = "*" then MsgBox(0,"Calculatoz","Result : "&Execute($n1*$n2))
If $nm = ":" then MsgBox(0,"Calculatoz","Result : "&Execute($n1/$n2))
If $nm = "/" then MsgBox(0,"Calculatoz","Result : "&Execute($n1/$n2))

Lord Trojan. :P

Edited by Trojan55

Link to comment
Share on other sites

You should check out Execute, instead of using names like plus and minus.

#include <Constants.au3>

MsgBox($MB_SYSTEMMODAL, '', 'The classic question, what is the meaning of life? - ' & Execute('40+2'))

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

one of my dreams is coding a universal complex calculator where people can freely add mathematical plugins..... sigh

It's not that hard at all. Unfortunately I broke all the links on >this page and can't find the files but I'll put you together an example if you like. Complex arithmetic isn't that hard either. Most of the basic operations are very simple, you just have to decide what something like (5-2i)! is, and other operations that usually only work on real numbers. I did a lot of complex arithmetic manually for a school project a couple of years ago. Ended up with functions like this, or this. I really wouldn't recommend doing something like this in C though, and there are probably better methods than me deriving things by hand. C++ has a complex arithmetic library in the standard now so would be good to use.

Plugin architecture would be a little more interesting. AutoIt's not really designed for that sort of work. I have a solution but it is not tidy and requires a script that modifies itself at runtime. It's either that or you need to have something that calculates values and outputs the result to the command line or some other interprocess communication. Manadar did make a plugin architecture, but again there is no good way to do it.

I've already done both an expression parser and a plugin architecture for C#, and it would be very easy in C++ as well. Python I imagine would be good to work with as well for something like this.

I used to have a section of the wiki that listed all the calculators people had written on the forum before. Not sure where that went to now.

Link to comment
Share on other sites

It's not that hard at all. Unfortunately I broke all the links on >this page and can't find the files but I'll put you together an example if you like. Complex arithmetic isn't that hard either. Most of the basic operations are very simple, you just have to decide what something like (5-2i)! is, and other operations that usually only work on real numbers. I did a lot of complex arithmetic manually for a school project a couple of years ago. Ended up with functions like this, or this. I really wouldn't recommend doing something like this in C though, and there are probably better methods than me deriving things by hand. C++ has a complex arithmetic library in the standard now so would be good to use.

Plugin architecture would be a little more interesting. AutoIt's not really designed for that sort of work. I have a solution but it is not tidy and requires a script that modifies itself at runtime. It's either that or you need to have something that calculates values and outputs the result to the command line or some other interprocess communication. Manadar did make a plugin architecture, but again there is no good way to do it.

I've already done both an expression parser and a plugin architecture for C#, and it would be very easy in C++ as well. Python I imagine would be good to work with as well for something like this.

I used to have a section of the wiki that listed all the calculators people had written on the forum before. Not sure where that went to now.

.

yes, i thought about a temporary, self-written script at runtime, after searching the plugin directory and #including the plugins on top. that seemed possible to me. but it gave me headaches to imagine a flexible gui that adds additional buttons afforded by the plugins.

of course the calculator should be able to accept, process and display multiple parentheses, all kinds of n-based systems (bin, hex, aso) and fractional arithmetics, logarithmic and circle functions. it needs an input and output field like an adding-machine and for mathematical and statistical analysis. and function solving...

i guess i am far too ambitious. i have seen just one calculator in the forum that processes basic arithmetics (5+6*2) and parentheses correctly.

i am not a mathematician, but very interested, i made some attempts in prime calculation and modular arithmetics (mulmod), so i am aware of autoit limits. unfortunately, i don't know c or c++, so i think i will never accomplish my idea.

but maybe it's about time to simply start it.

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

one of my dreams is coding a universal complex calculator where people can freely add mathematical plugins..... sigh

Check out eval() and calc() functions by Laszlo and derRaphael. They have an extensible parser architecture built to be able to handle custom functions.

http://www.autohotkey.com/board/topic/15675-monster-evaluate-math-expressions-in-strings/

http://www.autohotkey.com/board/topic/59087-func-calc-math-expression-evaluation-incl-brackets/

These are in AHK, but could easily be adapted to AU3.

The idea is that you can use notepad to type in your expression such as ((sqrt(2))/2-5)/fib(12)+cos(180) - then you select the expression in notepad and push a hotkey to get the evaluation of the selected text.

Edited by robertcollier4
Link to comment
Share on other sites

Check out eval() and calc() functions by Laszlo and derRaphael. They have an extensible parser architecture built to be able to handle custom functions.

http://www.autohotkey.com/board/topic/15675-monster-evaluate-math-expressions-in-strings/

http://www.autohotkey.com/board/topic/59087-func-calc-math-expression-evaluation-incl-brackets/

These are in AHK, but could easily be adapted to AU3.

The idea is that you can use notepad to type in your expression such as ((sqrt(2))/2-5)/fib(12)+cos(180) - then you select the expression in notepad and push a hotkey to get the evaluation of the selected text.

thx will look

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...