Thread: Help to do a calcutalor for arithmetic and relations !!!!Pls

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    1

    Help to do a calcutalor for arithmetic and relations !!!!Pls

    =>Create a calculator for arithmetic and relations calculations

    Prompt the user to enter an equation in the following format:
    oprand1 op oprand2
    oprand1 and oprand2 are both numbers and op should support common mathematical expressions. Your program should support the following arithmetic operators: +, -, *, /, % and the following relational operators: <, <=, >, >=, ==,!=. The program should keep prompting the user for new input until user provide exit signal.
    Details / Assumption / Hints
    1) Multiple Inputs
    2) Note that % operator requires integers, so if user enters doubles for that operation, you cast it to int and include the “Loss of Precision” message
    3) You need to handle the difference between arithmetic (a number) and relational (Boolean) results.
    4) You can either have the user enter some values to exit the loop or use cin.fail() to exit the loop
    5) Extra credit: Use string to read data from command line and then tokenized to extract the three values
    6) ** Do not use character to read in the op, some operators have two characters. Use string and strcmp()

    Sample Out :
    Attached Images Attached Images Help to do a calcutalor for arithmetic and relations !!!!Pls-pic-jpg 

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    This isn't a forum where you can simply copy/paste your assignment and hope for a complete answer on a plate, which you can just copy/paste back to your tutor.
    Announcements - General Programming Boards

    Post some actual effort to show us what you can really do, and we can help you with what you're genuinely stuck on (as opposed to appearing merely lazy and/or stupid).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Arithmetic Help
    By cduce2411 in forum C++ Programming
    Replies: 3
    Last Post: 03-18-2009, 11:58 AM
  2. arithmetic
    By shuo in forum C++ Programming
    Replies: 1
    Last Post: 01-20-2008, 05:29 PM
  3. Difference Equations / Recurrence Relations
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-05-2007, 10:26 AM
  4. arithmetic help
    By freeindy in forum C Programming
    Replies: 10
    Last Post: 09-18-2007, 08:01 AM
  5. mod arithmetic in C++
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 01-10-2002, 12:59 PM