Dev C%2b%2b Calculator Code

Codes Of Scientific Calculator In Dev C Codes and Scripts Downloads Free. The database access library for C programmers that provides the illusion of embedding SQL in regular C code, staying entirely within the C standard. A simple calculator is a calculator that performs some basic operations like ‘+’, ‘-’, ‘.’, ‘/’. A calculator does basic operation in a fast way. We will use switch statement to make a calculator.

  1. Contribute your code and comments through Disqus. Previous: Write a program in C to calculate the volume of a cylinder. Next: Write a program in C to find the area of any triangle using Heron's Formula.
  2. Dev-C-function of calculator - Duration: 9:50. Zulfiqar Ahmad Khalil 26,206 views. How To Insert Image Into Another Image Using Microsoft Word - Duration: 14:13.
  3. In below c programming code example, the user is prompted to choose the operations(i.e. Addition, subtraction etc) to be performed and then prompted to key in the values which are used to perform the operations. Then, the result will be shown as output to the user. Sample C programming code for Calculator Application.
  4. Since C programs always start at the main function, we need to call our other code from there, so a #include statement is needed. Some initial variables x, y, oper, and result are declared to store the first number, second number, operator, and final result, respectively.

Instructions | Definitions | Errors

Here you will learn how to code your first basic C++ Program: The Body Mass Index (BMI) Calculator!

DISCLAIMER: These instructions are for the sole purpose of learning the basics of input and output in C++. Do not base any medical decisions on results received from this program.

Note: To learn a little more about a subject in blue, click on the word for a brief definition.

Good Luck!

Step 1: Download Visual Studio

  • Go to http://www.visualstudio.com/downloads/download-visual-studio-vs
  • Scroll down and click on “Visual Studio C++ 2010 Express”.
  • Click “Install now”.
  • Sign in to Microsoft (or sign up).
  • Follow the instructions to install.

Step 2: Create New Project

  • Click File->New->Project.
  • Click “Visual C++” in the toolbar and select “Empty Project”.
  • Type “My First Project” into the Name textbox.
  • Click “OK”.

Step 3: Create the Source File

  • In the “Solution Explorer” toolbar, right click on “Source Files”, then click Add->New Item.
  • Click “Visual C++” under Installed Templates and select “C++ File (.cpp)”.
  • Type “MyFirstProject” into the Name textbox.
  • Click “Add”.

Step 4: Include your Standard Libraries

  • Write these two statements to include all of the standard libraries that we will need.

Step 5: Create your main Function

  • Write this statement to declare a function called “main”.
  • Write an opening and closing curly bracket to mark the beginning and end of the function.

Step 6: Create Variables

Dev C 2b 2b Calculator Code Java

  • Create a variable with a type of “int”, a name of “height”, and a value of “0”. You will do this by declaring the type first, then the name, and finally setting the variable “height” equal to it’s value, “0”.
  • Use a semicolon to end your statement.
  • Repeat this step to declare the variables “weight” and “BMI”, as shown in the picture.

Step 7: Write to the User

  • To write a message to the user, type “cout <<” and then type your message within double-quotes.

Step 8: Read from the User

  • To read a message from the user, type “cin >>” and then type the variable that you would like to save the input into.
  • For this first example, we will save their response into the “height” variable. This will overwrite the “0” that we saved into it initially, and save whatever the user types.

Step 9: Repeat Steps 7 and 8

  • Now you know how to read and write messages to the user! Do this again to ask for and save the user’s weight.

Step 10: Calculate the user’s BMI

  • You now have all of the information that you need to calculate the user’s BMI! The calculation is complex, but the computer calculates these mathematical expressions almost instantly. See the picture below for the equation.

Step 11: Display their results

  • Their BMI is now saved into a variable, and we need to display it to the user.
  • Use the “cout” command again to display a message to the user. Start by printing the message “Your BMI is: ” and then add the variable BMI by using the “+” operator, as shown in the picture.
  • Print out the BMI information chart so that they can interpret the result.

Step 12: Pause the Program

  • Use the system(“pause”) command to pause your program, as shown in the picture.
Dev

Step 13: Run your Program

Dev C 2b 2b Calculator Code C

  • Hit the little green triangle button on the top toolbar to compile and execute your code.

Dev C 2b 2b Calculator Codes

  • The final result should look like this:
Dev C%2b%2b Calculator CodeCode

Dev C 2b 2b Calculator Code C++

  • If you have any issues, please reference our “Errors” page for suggestions.