Click here to Skip to main content
15,902,114 members
Everything / Calculator

Calculator

calculator

Great Reads

by DrABELL
Educational software package for Microsoft Windows® 7/8 contains “5-in-1” School Math Calculators and Equation Solvers intended for students and educators
by Azim Zahir
How to create a Reverse Polish Notation (RPN) Calculator using Python
by Pete O'Hanlon
A simple web-based calculator shows how to let TypeScript interact with contents of a web page
by AlexeyYakovlev
This paper demonstrates a technique of building Sprache parsers using grammar inheritance.

Latest Articles

by Azim Zahir
How to create a Reverse Polish Notation (RPN) Calculator using Python
by Yücel Güven
IPv6 Subnet Calculator / Tool explained ( latest version: 5.0 )
by Pete O'Hanlon
A simple web-based calculator shows how to let TypeScript interact with contents of a web page
by Sergey Alexandrovich Kryukov
This is just a funny Visual Studio Code extension, but… what can happen if somebody will try to use it seriously?

All Articles

Sort by Score

Calculator 

17 Feb 2015 by DrABELL
Educational software package for Microsoft Windows® 7/8 contains “5-in-1” School Math Calculators and Equation Solvers intended for students and educators
17 Sep 2012 by fjdiewornncalwe
I haven't checked out all the links, but here are 225,000 Results[^] for you to start from. Please make an effort to search your question first. We are more than happy to help you with a specific issue you may encounter as you make an effort to get there.
28 May 2020 by CHill60
Your concept of how to parse the calculator text seems a little strange If CalculatorText.Text.Contains("-") Then Substract = CalculatorText.Text.Split("-") For Each NumToPower As String In Substract ...
27 Dec 2011 by OriginalGriff
This is going to sound a little strange, but try dropping the concept of "number1" and "number2".Instead, use Textbox1.Text as your "current input string area" and add to it in your button click event:private void button6_Click(object sender, EventArgs e) //add 6 to string { ...
27 Dec 2011 by Sergey Alexandrovich Kryukov
Here: http://sakryukov.org/freeware/calculator/[^]. This is just one file.Showing of the attribution and my copyright is required.—SA
16 Jul 2012 by Prasad_Kulkarni
What happened to Google[^], is it broken at your side? Try something by your self first, then post your questions if you get stuck'd somewhere. This is not at all appropriate. You can even try search on CodeProject[^] with same question and get many similar solved answers, as well as...
17 Jul 2012 by Rahul Rajat Singh
I think this is what you are looking forExpression Evaluator for C# based on Expression Tree[^]Just do the following using sample code in the above article:IParser par = new ExpParser();ExpEvaluator eu = new ExpEvaluator(par); string expresion =...
20 Jun 2016 by Garth J Lancaster
you could have a look at this Step 1: Create a Windows Forms Application Project[^] particularly steps 5,6.. there are plenty of other 'beginning winforms' articles on the web - let google be your friend - I say that not to be a pain, but pictures are worth a thousand words (trying to describe...
19 May 2017 by W Balboos, GHB
You have at least nine of these, with various "o#" and letters. if (document.getElementById("o1").disabled=false == "P") ocr = ocr + 21; They will always evaluate to false, since document.getElementById("o1").disabled=false doesn't return a character value So the incrementing of ocr will...
20 Dec 2020 by Rick York
printf("Enter num1: "); scanf("%d", &num1); //
9 Nov 2022 by Azim Zahir
How to create a Reverse Polish Notation (RPN) Calculator using Python
7 Sep 2011 by Pete O'Hanlon
OK, without knowing your skill level with C#, it's going to be difficult to answer this for you without actually writing all the code. The first parts are easy - basically, you have started an instance of calc, but you are storing the result in a local variable. If you want to end that same...
9 Mar 2012 by E.F. Nijboer
I think you would get a lot of thankful people that could really use something like this. This, of course, depends on the functionality implemented because that will also determine how useful it is. It might catch on even better if you would provide an easy way to extend it. For example a way to...
24 Mar 2012 by YvesDaoust
You can multiply much more efficiently the way Egyptians used to do (http://www.jimloy.com/egypt/mult.htm[^]): let M x N, you will find the '1' bits in M and add N multiplied by the corresponding powers of 2, obtained by doubling.Here is Python code that does it using only additions and...
28 Mar 2012 by Kschuler
Code Master123 wrote:I have looked all over and found nothing on GoogleWhat did you search for? Because I googled[^] and found all kinds of downloads for classes that are supposed to do the LM hash. I also found This link[^] that posts code directly. And a good explaination on...
21 Apr 2012 by Sergey Alexandrovich Kryukov
I must discourage you a bit: such big integer type with all required arithmetic already exists; this is the wonderful structure System.Numerics.BigInteger first introduced in .NET Framework v.4.0; please see:http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx[^].Even if...
16 Jul 2012 by uspatel
Have you made any effort or tried Google.
18 Sep 2012 by Sandeep Mewara
Here, this is wrong: var txtArea = txtWidth.value * txtLength.value;You already have values from control, no need to do .value again. OR if you want to then just get the object via getElementById.Further, while assigning back data, your control should be on left...
18 Sep 2012 by Sergey Alexandrovich Kryukov
You don't get the result because you never assign a value to the element txtPerimeter. Also, when you try to get an element to be used to output perimeter value, you override the numeric value previously calculated for this variable. As JavaScript is, apparently, a scripting language, which uses...
4 Jan 2013 by Andreas Gieriet
This is mainly a parsing task, not really suited for a C++ beginner.An expert in parsing would solve this within a few hours - a complete novice might take months to get it somehow done.I would choose a different topic, depending on your personal interests or hobby.Think also of where C++...
28 Oct 2014 by BillWoodruff
There are good examples of working infix calculators, and good solutions for the task of parsing a complex string and generating executable C# code, here on CodeProject; I suggest you search for those articles and read them to get ideas: [^].To make an infix calculator that really "works"...
29 Dec 2014 by ridoy
I think you are going on a wrong way.See some samples that will clear you:Introduction to Android development : TouchCalculator[^]Creating a simple calculator[^]Android calculator with button click[^]
31 Oct 2016 by Wendelius
To monitor the process start you can use ManagementEventWatcher Class (System.Management)[^] to monitor changes in Win32_ProcessStartTrace class (Windows)[^] or you can of course poll for running processes using regular interval. You can use for example Process.GetProcessesByName Method (String)...
16 Jun 2017 by OriginalGriff
Stop converting to strings, and convert to DateTime instead: If your value in the DatagridView is a DateTime, then use it directly: DateTime i = (DateTime) datagridview.currentrow.cell[4].value; If it's a string, then Parse it: DateTime i; if...
16 Dec 2017 by OriginalGriff
Quote: please help me send me the code We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial...
16 Dec 2017 by Patrice T
Quote: please help me send me the code or any idea of tax calculator Not the kind of help we provide here, give it a try, it is not really rocket science. We do not do your HomeWork. HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think...
16 Oct 2020 by OriginalGriff
It can't. What do you get when you multiply "bread is great" by "in a sandwich"? Nothing - it's a silly thing to try and do. But the framework doesn't know what the user is going to type - it might be a number, it might not. So your second...
22 Oct 2020 by CPallini
You should build a very simple parser: Check and discard the 'start' condition ("What is"), get the first number, assign it to current result. If you find the 'finish' condition ("?"), then you've done: report the result value. Gather the...
18 Aug 2021 by OriginalGriff
There is nothing in that code statement that is actually right! num1 === typeof(number) Should be "number" === typeof(num1) And the same for num2 The operator test: you can't write it like that: "-" is not a condition, nor are "*" or "/" You...
20 Aug 2021 by Richard MacCutchan
You need to return the relevant values from each of your functions: JavaScript return Statement[^].
29 Oct 2021 by Richard MacCutchan
Try this: foreach ($pay as $val) { $Capital -= $val; echo "Capital value: $Capital\n"; }
26 Apr 2022 by Pete O'Hanlon
A simple web-based calculator shows how to let TypeScript interact with contents of a web page
28 Jun 2022 by Patrice T
First of all, you can't add 2 matrices of different size. I would try this change: #include // This make the matrices and sizes global. int p,q,x,y; int a[100][100],b[100][100],c[100][100]; void add(){ int p,q,x,y,i,j; int...
23 Aug 2011 by jdcodes
i am trying to develop an android application, which takes input from the user. user speaks mathematical expression or just a number followed by a operator then again number, n finally call out calculate. then application display result. can any one guide me or lead me, how should i achive...
27 Dec 2011 by Joel Whatley-
I have a test calculator - It's setup with 2 textboxes (the main one and a side one)the main one is where it shows the users input for the first number (string number1 - yes sring ill convert it later) and then when the users selects a tool like Add, Subtract, Divide or Multiply, number1...
27 Dec 2011 by nishantcomp2512
//add multiply or division etc click private void button6_Click(object sender, EventArgs e) //add 6 to string { if(textBox1.Text != string.Empty && textBox2.Text!=string.Empty) { switch(((Button)sender).Text) ...
27 Dec 2011 by OriginalGriff
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...A very quick search gave loads of hits...Google: scientific calculator c#[^]
9 Mar 2012 by YuriMaks
My questing may be strange (or I chose bad place for ask)...warning! bad english area, I'm sorry...Project idea is simple. Sometimes you have to implement spreadsheet-like behavior in your application, but you don't want to use MS Excell via COM or ActiveX either to invent you own...
24 Mar 2012 by Member 8756580
I have to make a calculator in Little Man Computer http://www.atkinson.yorku.ca/~sychen/research/LMC/LittleMan.html[^]I'm stuck I can't find anyway around it I have found that you can multiply by adding the number for as many time stated. The calculator has to be able to multiply, add,...
28 Mar 2012 by Code Master38
I was wondering is there a way to calculate the old LM hashes for windows in .net? I have looked all over and found nothing on Google, however I found Ophcrack generates them and I'm wondering how?I have to find a way to generate them as a homework assignment, so any help would be nice!
5 Apr 2012 by Youngguns
Hi, I'm making a database in access for a small business that sells curtains, blinds, cushions and various other products. I need to make monthly reports for each product, however i'm not sure how I would go about doing this. So far I have made a query for calculating the total price of an order...
5 Apr 2012 by angel94
hope this may help youhttp://www.youtube.com/watch?v=i72sqEBBALs[^]
21 Apr 2012 by Member 8863422
For my programming class I need to make a super calculator that allows me to multiply, divide, add, subtract, compare, and calculate factorials of big numbers. I got the code to compile without errors and everything works except for the compare function. When I input two numbers and make...
4 May 2012 by Nelek
It is not going to be easy, and going to need more lines of code than you think.You will need to parse the input string to search for the symbols and the numbers, differenciate the trigonometry functions, check spelling (possibly giving errors or autocorrection), add the () where needed...
4 May 2012 by Philippe Mori
You might also uses boost if you want to do it in C++ (or in mixed mode with C++/CLI).http://www.boost.org/doc/libs/1_49_0/libs/spirit/doc/html/index.html[^]For the number of lines of code, it would depends a lot on how you do it...
17 Jul 2012 by Rubinder
I need a code which can solve the equations like this :-56*78+(78/8)In this we know that brackets must be solved first and then divide/multiply and then add/subtract.So, i need a code for solving this kind of equations which contains multiple operators in single line.Thnks :)
17 Jul 2012 by JF2015
You should use google to search for "mathematical expression parser". There are thousands of results. Here are some promising ones:Mathematical Expression Parser Using Recursive Descent Parsing[^]a Tiny Parser Generator v1.2[^]Simple(x) Numerical Formula Parser[^]Expression Evaluator for...
20 Nov 2012 by ashishsrivastava22@yahoo.com
i m developing an application about my city auto fare calculator for Windows 8 app in Visual Studio 2012 my problem is ...can't accept only one decimal value in textbox plz help me out like Ex. 1.25456 Not 1.2.314
20 Nov 2012 by shahzads
23 Mar 2013 by theunk0wn
Hey guys, recently I have started to build a normal calculator which recently I was able to design it so that it can read more than two numbers in a single calculation but only with one single operator (e.g. 1+2+3+4 = 10). However when I try to do calculations with multiple operators, it doesn't...
4 Jun 2021 by kk2014
hi all,i have two HTML text boxes inside repeater. on text change of those text box i want to do sum and display in 3rd HTML text box using JQuery.how can i achieve it?Thanks,KK
24 May 2013 by Mahesh Bailwal
Below is sample codeASPX code Untitled Page ...
13 Nov 2013 by Member 10399841
Finally got something clicking in my frantic mind, I slowed down and actually tried to understand my situation. I just took it step by step and now I atleast have a solver that can be solved by input of A, B and C. It may not be able to find A, B and C by itself but it is a start. I will just...
6 Jan 2014 by Cri784
Hello,Can someone give me a hand with this Excel formula, in order to convert it to JAVASCRIPT: =((DAY((DATE(YEAR(A1),1+MONTH(A1),1)-1))-(DAY(A1)))/(DAY((DATE(YEAR(A1),1+MONTH(A1),1)-2))))+(DATEDIF(A1,B1,"m")-1)+((DAY(B1))/(DAY(DATE(YEAR(B1),1+MONTH(B1),1)-1)))to JAVASCRIPT? Thanks,...
6 Jan 2014 by Richard MacCutchan
See http://www.w3schools.com/jsref/jsref_obj_date.asp[^].
6 Jan 2014 by Cri784
Thank you for the fast answer, but is not what I was looking for.I have found out something that is closer to what I'm searching for, but this code gives the answer in months and days:Calculate Age / Duration Between Two Dates using JavaScript[^]I need a code that will calculate the...
14 Apr 2014 by TheOraclePhD
Write a Prolog codethat accepts input of CGPA from user and determines the level of that CGPA; > 0 and = 2.00 and = 3.00 as “excellent”. The example ofoutput for the Prolog code is as follows: ?- run.Enter your CGPA:...
14 Apr 2014 by TheOraclePhD
CGPA; > 0 and = 2.00 and = 3.00 as “excellent”. The example ofoutput for the Prolog code is as follows: ?- run.Enter your CGPA: 1.60.Your CGPA is poor.?- run.Enter your CGPA: 2.00.Your CGPA is good.?-...
29 Dec 2014 by M.FarrukhFaizy
Hello I am new to android development and just checking my skills so i starting making a simple calculator i have completed its .xml but failed to caught values from button and add them or so.Here's my Code package com.example.decen_000.myapplication;import...
26 Feb 2015 by YouCanHateMeNow
Hey guysIm doing a IPv6 Shortner and Expandtool in Visualbasic.How can I check if a textbox contains a specified charachter and if it does, it should be replaced by something else.So I got a Textbox, and if there is "::" in the textbox, the program should replace the "::" with a...
26 Feb 2015 by CHill60
Put something like textBox1.Text = textBox1.Text.Replace("::", "0000:0000") in the Validating event of the textbox. Or if you want it to happen as the user types then put it in the TextChanged event - not my favourite.[EDIT]I'm guessing you could have several of these so I've tidied...
26 Feb 2015 by Richard MacCutchan
Get the value from the text box as a string. You can then use any of the String Methods[^] to modify the content, and set it back into the textbox.
11 Mar 2015 by Richard MacCutchan
For the operations you have in your sample it is just a matter of reading the items in order eg:17 + 3 - 11 * 44 / 6Read first three items (operand1 operation operand2)Do the calculation and save the answer as the new operand1.Get the next two items (operation operand2)Do that...
21 Nov 2015 by OriginalGriff
Start by looking at your code with teh debugger, and follow it through to see exactly what is happening.Then, you will see that it's quite simple:string[] tokens = startIP.Split('.');int value1 = Int32.Parse(tokens[0]); // 192int value2 = Int32.Parse(tokens[1]); // 168int value3 =...
22 Mar 2016 by Member 12409152
int num01; int num02; int num03; Console.Write("Type your first number: "); num01 = Convert.ToDouble(Console.ReadLine()); Console.Write("Type a number to be added to: "); num02 =...
22 Mar 2016 by Patrice T
You should tryConsole.WriteLine("The result is " + (num01 + num02 * num03));Quote:searches on google, youtube but cant find any explantion about multiple operators. The problem is that + don't do what you expect when there is a string.You should study documentation of your language. This...
25 Aug 2016 by Member 12703506
Hello i'd make a simple calculator example using ANTLR but there is a problem in operations (/,*,-,+) priority my code give them the same priority ,i need to make a top priority for multiplication and divisionthis is the grammar:grammar Calc; start : expr EOF;expr: expr...
2 Sep 2016 by Ghostdragon777
I've recently started to try to learn java and today I tried to make a calculator. When I run the code and say to add, subtract, multiply, or divide, it always comes out with "That is not a correct operator". Please try to be specific... here is the code (I use the netbeans...
2 Sep 2016 by Patrice T
You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.The debugger allow you to follow the execution line by line, inspect variables and you will see that there...
2 Sep 2016 by Garth J Lancaster
well, its been some time since I did java, but Im pretty sure of a few thingsa) Netbeans allows you to step through your code (debug) - trust me, its a good skill to learn, and allows you to see what your variables contain (for example) b) if your code is all the way at the end, then, do...
13 Oct 2016 by Member 12792145
I have grades in array and I want the run them threw a letter grade I loop it so It can tell he how many A I got how many B I got and so on.void StatsList::PrintGradeCount(){ double gcount = 0; while (int j =! 1); { gcount = gcount + List[Listindex]; if (gcount...
13 Oct 2016 by Patrice T
What you do looks rather confuse, use the debugger to see what your code is doing. if (gcount = 90) { cout = 80) { cout
21 Mar 2017 by RaviRanjanKr
You can use below code. private void txtBox_P1In_KeyPress(object sender, KeyPressEventArgs e){ if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.')) { e.Handled = true; }}and though you are working on calculation type...
19 May 2017 by Patrice T
When you don't understand what your code is doing or why it does what it does, the answer is debugger. Use the debugger to see what your code is doing. Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute, it is...
13 Nov 2017 by Member 13518271
My DO/WHILE loop doesn't work. Help me too find the mistake, please!! #include #include #include using namespace std; int main() { char exit; float a,b,result; int s1,s2,s3,s4,s5; do { cout
13 Nov 2017 by KarstenK
The answer to your question is, that the "exit" must be initialized like this: char exit = 'n';//no exit More intuitive is to code the loop in that way:while (exit != 'y'); For a better programming experience I would refactor your "spaghetti code" into some functions.
13 Nov 2017 by Patrice T
Learn to indent properly your code, it show its structure and it helps reading and understanding. #include #include #include using namespace std; int main() { char exit; float a,b,result; int s1,s2,s3,s4,s5; do { cout
13 Nov 2017 by Jochen Arndt
As already mentioned you have to initialise exit with a value. But you never set the variable elsewhere in your code. Instead, you are reading user input at the end of the wile loop into the a variable. So you have to change that too: char exit = 'y'; // ... case 5: //{ // This...
25 Dec 2017 by OriginalGriff
iT's not going to be that simple - that you ask the question "which language should I use?" show that you don;t know enough yet to get started on the project. Web based code has two components: Server based code which prepares and serves pages, and Client code that runs in the browser at the...
23 Jan 2018 by Richard MacCutchan
Basic application development tips: Input and output in 8086 Assembly Language[^]
10 Feb 2018 by Member 13672107
I click a number, added it(becomes var1), click number again, press equal(2nd number becomes var2) and operates it. now when i click equal again(which is making the now output var2) it adds it to var1. what i want to do is if you click equal again the var1 will change to the first var 2. Im not...
10 Feb 2018 by RickZeeland
You can replace all those button click handlers by one, like this: Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click Dim index As Integer If Integer.TryParse(CType(sender, Button).Tag.ToString, index) Then ...
3 Aug 2018 by K-SIS
using Microsoft.VisualBasic you can use VAL() function to avoid above problem.
24 Mar 2019 by Gerry Schmitz
I never understand why folks want to muck with the grid; when adding calculations to the "data source items" seems so much simpler. Like making a meatball sandwich without the meatball. Anyway ... c# - Calculation in DataGridView column - Stack Overflow[^]
15 Feb 2020 by OriginalGriff
That's actually quite a bit of work. You need to read the user input as a string, and then process it into tokens - and how complex that process gets depends on how "full" your calculator is. By that, I mean do you want to just process this:3+2.5...
15 Feb 2020 by Patrice T
Quote: I think I should use string for it but I couldn't make it. Since keyboard input can only be done with a string/buffer, the comment suggest you are very beginner. A calculator with inline input is rather complicated. Pretty soon, you need...
15 Feb 2020 by KarstenK
The simplest way is to ask for the operation and than for two numbers, else it is a bunch of work. When you want to do it in C it is a lot of work, because you have to do it all on your own. Higher languages as C++ have string classes which...
15 Feb 2020 by CPallini
As an alternative to the 'parsing approach', you might embed in your C application a scripting language (see for instance Embedding a scripting language inside your C/C++ code[^] ) and let the latter to do the bulk of the work (i.e. compute the...
28 May 2020 by Doctor GME
this is my calculator design: https://www3.0zz0.com/2020/05/28/19/797035332.jpg[^] the upper textbox is for calculation while the lower is for result it is very simple for me to write a calculator which can do simple process like: 1 + 1 or 2 -1...
21 Jul 2020 by The Digigraphy
Hello, I am creating a software which would find out the production complete date based on start date. This will be working like it would find out the total hours required to complete the production and then add it to start date. I WANT TO KNOW...
21 Jul 2020 by Garth J Lancaster
Not 100% sure what your asking for, it is 'this' ? If prodShiftWorkingCheckBox.Checked = True Then ' Do the Calculation ' Display the Result Somewhere End If
16 Oct 2020 by brandon1999
hi, so i have 2 labels. one of them is a fixed number and doesn't change but the other one changes every 5 seconds. Now i want to multiply them automatically and show them in another label as Results. what should i do? what am i doing wrong? ...
20 Dec 2020 by Mieczyslaw1683
I am trying to create a calculator program, coding in C, and it can't divide 1/2 correctly, it gives 0.000000. So therefore I ask you how to fix the code so that the program divides correctly? The code: #include #include ...
20 Dec 2020 by OriginalGriff
Start by finding out what it's working with: the simplest and quickest way (in the long run) is to use the debugger - a quick google for the name of your IDE and "debugger" will find you the instructions - but adding printf statements to show the...
14 Sep 2021 by Member 15358161
Quote: So, i have this code selecting from payment and i want to calculate each payment base on the payment id in other to get the balance for each payment. Some payment id has five to seven payment and i want to be able get each payment multiply...
14 Sep 2021 by Wendelius
First of all, don't concatenate text directly to a SQL statement. This leaves you open to SQL injection - Wikipedia[^]. Instead, use parameters, see PHP MySQL Prepared Statements[^] What comes to the actual question, I'd do the calculation in...
18 Sep 2021 by BillWoodruff
Your question and code indicate you need to get a good book on C#, and study the basics of the language, as well as study how Controls, like TextBox, work. I recommend a somewhat older book by Chris Sells: [^] A TextBox [^] accepts...
18 Sep 2021 by OriginalGriff
You will have to read the string, break it into the various operators and operands, then process the formula as entered - once you have checked that it's a valid formula, that is. What you have will not work at all. There are a number of ways to...
18 Sep 2021 by Dave Kreskowiak
You REALLY need to look at what you're doing and thinking about it instead of guessing. What do you think this is going to do? number1 = Convert.ToInt32(textBox1.Text); number2 = Convert.ToInt32(textBox1.Text); You're converting the...
18 Sep 2021 by Gerry Schmitz
private void button1_Click( object sender, EventArgs e ) { int number1, number2, result; if ( textBox1.Text.Contains( "+" ) ) { var tokens = textBox1.Text.Split( "+" ); if ( tokens.Length == 2 ) { ...