[Delphi]Program a Simple Calculator

Discuss about Programming here. You may release your source, post guide and even ask questions!

Moderator: wizme

User avatar
RavenOfDeath
Headmaster of Darkness
Headmaster of Darkness
Posts: 725
Joined: Mon Feb 08, 2010 6:43 pm

Re: [Delphi]Program a Simple Calculator

Post by RavenOfDeath »

Boredness wrote:
RavenOfDeath wrote:i could code a scientific calc.
NPNT
lmao i take ss show u
Goals:
Top 10 poster in Xemectrum [V]
Top 5 poster in Xemectrum [X]
Top 3 poster in Xemectrum [X]
Top poster in Xemectrum [X]
wizme
Destiny General
Destiny General
Posts: 297
Joined: Sat Sep 05, 2009 1:40 pm

Re: [Delphi]Program a Simple Calculator

Post by wizme »

isnt it the same just the cal method diff ? ...
Unlike science, love is like magic, there's no reason to it - wizme =)
Learn more of security, click here =)
User avatar
RavenOfDeath
Headmaster of Darkness
Headmaster of Darkness
Posts: 725
Joined: Mon Feb 08, 2010 6:43 pm

Re: [Delphi]Program a Simple Calculator

Post by RavenOfDeath »

wizme wrote:isnt it the same just the cal method diff ? ...
yes... :lol:
Goals:
Top 10 poster in Xemectrum [V]
Top 5 poster in Xemectrum [X]
Top 3 poster in Xemectrum [X]
Top poster in Xemectrum [X]
PIEzLOVERS
Master of Darkness
Master of Darkness
Posts: 431
Joined: Sat Dec 12, 2009 9:01 pm
Location: Heaven !
Contact:

Re: [Delphi]Program a Simple Calculator

Post by PIEzLOVERS »

heres the code in VB

just dumb 2 text box and 1 button and paste the code.....
tada a calculator XP

Code: Select all

Public Class Form1

    Private Function AddTwoNumbersResult(ByVal first As Integer, ByVal second As Integer) As Integer

        Dim answer As Integer
        answer = first + second
        AddTwoNumbersResult = answer

    End Function


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim first As Integer
        Dim second As Integer
        Dim result As Integer

        first = Val(TextBox1.Text)
        second = Val(TextBox2.Text)
        result = AddTwoNumbersResult(first, second)
        MsgBox("The answer is " & result)
    End Sub
End Class
User avatar
KFSPC8
Master of Darkness
Master of Darkness
Posts: 494
Joined: Sat Jun 05, 2010 6:18 pm
Location: Singapore

Re: [Delphi]Program a Simple Calculator

Post by KFSPC8 »

A detailed explanation on each line of code would be helpful :)
Eg. like what this simple code actually do and stuff

Code: Select all

procedure TForm1.BtnPlusClick(Sender: TObject);
begin Handleop('+'); end;
zile
Apprantice Knight
Apprantice Knight
Posts: 17
Joined: Sun May 30, 2010 4:46 pm

Re: [Delphi]Program a Simple Calculator

Post by zile »

if you want to code a scientific a calculator in c++, a calculator that can calculate the input of "1*61+(6/2)*82+6" correctly
use Shunting-Yard Algorithm to convert the input to Reverse Polish Notation, then code a Reverse Polish Notation calculator to solve it

if delphi has vectors/list, then you can do it there too
Post Reply