-
August 20th, 2013, 10:42 AM
#22
Re: how can i convert write() procedure to cout?
Originally Posted by laserlight
It depends. I have no clue what is the syntax and semantics of this programming language that you are trying to design and implement. What I do know is that whatever the syntax, you can translate a write to standard output in that language to C++ code involving std::cout, without having to write some C++ function (template, or class) with the C++ syntax that you have in mind. In other words, concentrating on C++ seems like it is taking you off course. Rather, concentrate on the syntax and semantics of your language, and how you will be translating that into C++ without unnecessary frills.
see these:
write("hello world" , NewLine, varname1)
to c++:
'write(' -> 'std::cout <<';
',' - > '<<';
'Newline' -> 'std::endl'
then i can delete the last ')' and add the ';'
(even for Read(varname1) is more or less the same.. except the Read() that must be '_getch()'. the 'cin' don't do the job, i think)
it's easy to translate
Last edited by Cambalinho; August 20th, 2013 at 10:48 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|