Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 848647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:58:37+00:00 2026-05-15T06:58:37+00:00

I’m needing to write a program (C#) that will allow the user to create

  • 0

I’m needing to write a program (C#) that will allow the user to create generic formulas with variables and numbers. For example:

D = A + (A - C / X)(7.8 - 6.6)
F = E + (E - C / X)(7.8 - 6.6)
FinalResult = (A + D)(0.9) + (E + F)(0.32) + B(0.1) + .023

where all variables would mean for me to go to a database and look something up based on values and return a number in its place. So A would be 2.12 for example (and the same for C and E)

Whats the best way to structure this program? How would I make my program read these formulas?

I’ve seen a little bit of the MathML but not sure how to get that started (or an example of it)

–Update–

I mentioned MathML just seeing some other questions involving it on SO. Y’all are correct, I’m not needing to display it, I’m just needing to identify what someone wants and use that to calculate something.

My variables will map to something in a database. For example, A would tell me to use the following:

Vend_Key = 3
Trmnl_Key = 5
Prod_Key = 7

which would then be used to return a number from a database.

I’m going to need a database to save the formula’s that people create. I’ll have to have a scheduled task that can run and execute these functions and save the information somewhere else.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:58:38+00:00Added an answer on May 15, 2026 at 6:58 am

    So basically you need a calculator?

    If so, then what I would do first is to search & replace the variable letters with their value, and then you can use some algorithm for evaluating the expression such as first converting it to postfix notation (much easier to evaluate in an algorithm) using something like this (google for infix to postfix algorithm for more and examples):

    • Scan the Infix string from left to right.
    • Initialise an empty stack.
    • If the scannned character is an operand, add it to the Postfix string. If the scanned character is an operator and if the stack is empty Push the character to stack.

      • If the scanned character is an Operand and the stack is not empty, compare the precedence of the character with the element on top of the stack (topStack). If topStack has higher precedence over the scanned character Pop the stack else Push the scanned character to stack. Repeat this step as long as stack is not empty and topStack has precedence over the character.

      Repeat this step till all the characters are scanned.

    • (After all characters are scanned, we have to add any character that the stack may have to the Postfix string.) If stack is not empty add topStack to Postfix string and Pop the stack. Repeat this step as long as stack is not empty.
    • Return the Postfix string.

    When you have the postfix string ready, you can use the simple postfix evaluation algorithm which basically goes like this:

    • Scan the Postfix string from left to right.
    • Initialise an empty stack.
    • If the scannned character is an operand, add it to the stack. If the scanned character is an operator, there will be atleast two operands in the stack.

      • If the scanned character is an Operator, then we store the top most element of the stack(topStack) in a variable temp. Pop the stack. Now evaluate topStack(Operator)temp. Let the result of this operation be retVal. Pop the stack and Push retVal into the stack.

      Repeat this step till all the characters are scanned.

    • After all characters are scanned, we will have only one element in the stack. Return topStack.

    topStack will be the result of your expression.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 419k
  • Answers 419k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Options: RegisterHotKey if you need to register just one or… May 15, 2026 at 10:28 am
  • Editorial Team
    Editorial Team added an answer Best option is to use .delegate(). Its a new event… May 15, 2026 at 10:28 am
  • Editorial Team
    Editorial Team added an answer You can use a UIImagePickerController to allow the user to… May 15, 2026 at 10:28 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.