-
c++program(please)
Hallo everybody:
My professor asked me to write a program in c++ .This is the
description of the program:
A program in the language is made up of a sequence of statements.
Each statement is either an assignment statement or a print
statement. All statements are terminated by a semicolon (. There
are no control statements of any kind, and execution always proceeds
from the first to last statement.
An assignment statement is made up of a variable on the right hand
side, an equal sign (=) and an expression on the right hand side.
Variables need not be declared before they are used.
Print statements consist of the keyword PRINT (any case) followed by
a list of expressions separated by commas. When the print statement
executes the values of the variables will be tab separated and
printed on a line. Print statements will always print a newline after
printing their list of variables.
Expressions may be simple variables or constant values, or they may
include infix operations like multiplication, division, addition,
subtraction and power (*, /, +, -, ^). Also the minus sign (-) serves
a dual purpose as the infix subtraction operator and a prefix
negation operator. The order of execution rules are the standard ones
for these operations (negation, power, divide and multiply, and
addition and subtraction). Given the same precedence level,
expressions are executed left-to-right. Parenthesis can be used to
override the order of execution.
Variables may be any valid identifier that is not a keyword (The only
keyword is 'PRINT'). Variables are automatically declared when they
are first used. Variables that have not been assigned to have a value
of zero.
Values are real numbers and should be internally represented as a
double- precision floating point number, even if they do not include
a decimal point.
The simplify method::
The simplify method will transform the expression subtrees into a
more abstract representation. The exact transformation depends on
your grammar, but the idea is to remove the extra non-terminals
needed to take care of the order of execution rules. The result
should be a correctly ordered tree whose nodes are all arithmetic
operations or simple values. Note that this will also remove the node
needed to handle parenthesis.
The dump method
The dump method should print an indented list the nodes and what they
contain. For example, the output for this statement: X = X*2+Y might
look like this:
Assignment
X
=
BinaryOp
BinaryOp
X
*
2
+
Y
To make this work you will have to pass the dump method the current
indention level (probably an integer) and increment it when you call
your children nodes.
----------------------------------------------------------------------
----------
the program is due 10/10/2001. This program worths 10% of the class
grade.
I am not good in c++ and I realy need your help on this. I am willing
to pay for whoever write the program for me. Please e-mail me ..
Thank you and you have a good day....
09/28/2001
-
Pay? Hmm, this sounds cool. I know how to do this thing but I think it's kind of cheating if someone else does it.
Let's see if I'm getting this right. It should be some kind of script parser? I have done script parsers before so this one doesn't seem to be any problem. However, I still think you should try yourself. I can provide you with expression evaluation code if needed (the most complicated bit of the script parsing in my opinion). Good luck!
-
-
Thank you all for replying:
I am going to work on this program myself, but what if I cannot finish it before 10/10/01. This means i will loss the 10%.
This is the second assignment, I already did one and it also worthed 10%, but it was in Pascal, and it was like 200 lines code.
the problem is that i am not good in C++ ...
looking forword to get a reply from you either in here or on my e-mail : [email protected] or [email protected]
-
Mayor of Awesometown
You don't understand, do you? We don't care that you're not good in C++. There's lots of newbies here that can't program what you asked. The difference is, they actually try to begin and post when they strike a problem. Nobody's going to help if you just ask them to do all of your homework for you. IMHO, if you aren't willing to try to figure it out yourself, there's no reason for you to be in the class.
-
Well, if you can't finish this assignment in 2 weeks, it's probably a sign that the course is too hard for you.
Make reasonable progress and ask specific questions, and people will be a lot more willing to help you.
-
Originally posted by ta1samail
Thank you all for replying:
I am going to work on this program myself, but what if I cannot finish it before 10/10/01. This means i will loss the 10%.
This is the second assignment, I already did one and it also worthed 10%, but it was in Pascal, and it was like 200 lines code.
the problem is that i am not good in C++ ...
With all due respect, you won't get good in C++ by having others do your work for you. Maybe you'll lose the 10%. Life goes on. What kind of course has you code in both pascal & c++, but no prerequisite that you know them?
-
Thank you all for your replies:
I understand that in order to be good in c++, I have to do this homework by myself. I didnt say I am not going to work on it, I am saying that i need help in it, such as , an idea in how to start, some good codes (functions) and stuff like that.
I am a computer engineering student, this class is elective, i thought it will be fun to learn 4 languages in one semster (pascal, c++, python and java). The last day for drop has past and i am stock on this class.
That is why i asked for help and said i am willing to pay,, because i realy want to pass this class
thank you and you all have a good and safe weekend
-
I have sent an e-mail to my professor and he said that the first step i should do is to convert the program i did in pascal into c++
so, i will send you the program later, if you can help me in converting it.
thank you all
Popular pages
Recent additions