Problem with C# program

Discussion in 'C#' started by abkraj, Oct 2, 2010.

  1. abkraj

    abkraj New Member

    Joined:
    Oct 2, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    C# program that will act as a simple calculator. The
    calculator will be run from the command line and will only work with integer numbers and
    the following arithmetic operators + - * / % and it also must work with unary operators......i have the code working for +,-,*/,% operators........could someone help me out by providing the logic to implement unary operators +,-.......
     
  2. Love.NET

    Love.NET New Member

    Joined:
    Nov 20, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://sites.google.com/site/esubstance
    Simply, you need a parameter of string, the string input from command line may like "a+b". After getting this string, you have to split it into operands (a and b in the Ex) and operator (+ in the Ex), check if operands are integers and operator is one of the supported operators (+,-,*,:,%). If there is an error, print out that error and exit. The user has to run your app from command line again until he input a proper parameter.
    Hope that help !
     
  3. techgeek.in

    techgeek.in New Member

    Joined:
    Dec 20, 2009
    Messages:
    572
    Likes Received:
    19
    Trophy Points:
    0
    Occupation:
    EOC (exploitation of computers)..i m a Terminator.
    Location:
    Not an alien!! for sure
    Home Page:
    http://www.techgeek.in

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice