1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help Help Help Help

Discussion in 'C' started by Resh, May 6, 2007.

Thread Status:
Not open for further replies.
  1. Resh

    Resh New Member

    Joined:
    May 6, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Hi my name is Resh. I need urgent help with C++ it is due on Thursday and this is my last resort... PLEaSE help anybody who can

    PLEASE PLEASE PLEASE!!


    SECTION A

    In preparation a C++ source file, a programmer has written the assignment statement in long-hand form as shown below:

    a = a + 12;

    rather than in its short-hand form shown here:

    a+=12;

    This also applies to other operations such as -,*,/ and %.

    Develop a class which reads the source file and provides the necessary operations for replacing the assignment statements as listed below:

    a = a + …...; by a+=……;
    a = a - ……; by a-=….….;
    a = a * ……; by a*=….…;
    a = a / …….; by a/=……..;
    a = a%…….; by a%=……;

    In the above example, the variable ‘a’ is chosen for the purpose of illustration and ‘…’ indicates the rest of the expression that is not of interest to us. For example, in a typical program expressions may appear as:

    volt = volt + value*sqrt(root);
    fraction = fraction / total;

    Write the necessary C++ program to carry out the required transformations.

    SECTION B

    Extend the class developed in Section A so that:

    a) If the message “all” is sent to the object, all assignments are converted to their short form as described in Section A.
    b) An assignment of the form t = t + 1
    is reduced to its post fixed form t++
    c) Explore how the polymorphism feature of C++ could be exploited in this class
    Hierarchy
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    Duplicate of [thread=4191]i need plenty help!!! with some C++[/thread]. Thread closed.
     
Thread Status:
Not open for further replies.

Share This Page