|
Hi my name is Resh.....i am seriously desperate for some help in C++ can any body help me. This is due on Thursday 10th May 2007 and this is my last resort because i can't get this out PLEASE PLEASE PLEASE HELP!!
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
|