Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Help Help Help Help (http://www.go4expert.com/forums/help-help-help-help-t4192/)

Resh 7May2007 03:19

Help Help Help Help
 
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

shabbir 7May2007 08:03

Re: Help Help Help Help
 
Duplicate of i need plenty help!!! with some C++. Thread closed.


All times are GMT +5.5. The time now is 00:23.