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

This is a discussion on Help to do a calcutalor for arithmetic and relations !!!!Pls within the C++ Programming forums, part of the General Programming Boards category; =>Create a calculator for arithmetic and relations calculations Prompt the user to enter an equation in the following format: oprand1 ...

  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  

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,592
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 04: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, 11:59 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21