Click here to Skip to main content
15,888,984 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: IHTMLServices Pin
led mike22-Oct-08 11:05
led mike22-Oct-08 11:05 
AnswerRe: IHTMLServices Pin
led mike22-Oct-08 8:49
led mike22-Oct-08 8:49 
QuestionCache management implementation for C++ Pin
Ahmed Charfeddine22-Oct-08 6:16
Ahmed Charfeddine22-Oct-08 6:16 
AnswerRe: Cache management implementation for C++ Pin
James R. Twine22-Oct-08 7:57
James R. Twine22-Oct-08 7:57 
GeneralRe: Cache management implementation for C++ Pin
Ahmed Charfeddine23-Oct-08 23:17
Ahmed Charfeddine23-Oct-08 23:17 
Questionhow to set journal hook? Pin
anminxin22-Oct-08 5:21
anminxin22-Oct-08 5:21 
AnswerRe: how to set journal hook? Pin
Rajesh R Subramanian22-Oct-08 20:07
professionalRajesh R Subramanian22-Oct-08 20:07 
Questionsimple interpreter Pin
harcaype22-Oct-08 4:56
harcaype22-Oct-08 4:56 
hi. I am trying to create a simple interpreter wherein it simply adds and subtracts.

Sample Input:

y = 5 + 8;
cout << y;

Output: 13

I have already started using stacks however it seems that it cannot pass through other commands after reading the input. Here's the code (Actually, I got this code from the net but it seems not to work):

#include<iostream>
#include<stack>
#include<string>
using namespace std;

int main(){
stack<string> syntax;
string word;

while (cin &gt;&gt; input) //after this, it no longer passes to the next syntax
{
syntax.push(word);
}

cout &lt;&lt; "Number of words: " &lt;&lt; syntax.size() &lt;&lt; endl;

while(!syntax.empty())
{
cout &lt;&lt; syntax.top() &lt;&lt; endl;
syntax.pop();
}

cout.flush();
return 0;
}

Do you have any ideas? Confused | :confused:
AnswerRe: simple interpreter Pin
Mark Salsbery22-Oct-08 5:26
Mark Salsbery22-Oct-08 5:26 
GeneralRe: simple interpreter Pin
CPallini22-Oct-08 9:26
mveCPallini22-Oct-08 9:26 
AnswerRe: simple interpreter Pin
CPallini22-Oct-08 9:30
mveCPallini22-Oct-08 9:30 
AnswerRe: simple interpreter Pin
David Crow22-Oct-08 10:02
David Crow22-Oct-08 10:02 
GeneralRe: simple interpreter Pin
harcaype23-Oct-08 2:10
harcaype23-Oct-08 2:10 
QuestionRe: simple interpreter [modified] Pin
David Crow23-Oct-08 2:54
David Crow23-Oct-08 2:54 
AnswerRe: simple interpreter Pin
harcaype23-Oct-08 4:23
harcaype23-Oct-08 4:23 
QuestionControl outgoing TCP/IP connections Pin
od@ananzi.co.za22-Oct-08 4:23
od@ananzi.co.za22-Oct-08 4:23 
AnswerRe: Control outgoing TCP/IP connections Pin
Richard Andrew x6422-Oct-08 18:00
professionalRichard Andrew x6422-Oct-08 18:00 
Questioncovert / cast int to char* with a twist Pin
Programm3r22-Oct-08 4:22
Programm3r22-Oct-08 4:22 
AnswerRe: covert / cast int to char* with a twist Pin
James R. Twine22-Oct-08 5:08
James R. Twine22-Oct-08 5:08 
AnswerRe: covert / cast int to char* with a twist Pin
Mark Salsbery22-Oct-08 5:12
Mark Salsbery22-Oct-08 5:12 
QuestionHo wto close running application before uninstallation?? Pin
tarunclassic22-Oct-08 3:46
tarunclassic22-Oct-08 3:46 
AnswerRe: Ho wto close running application before uninstallation?? Pin
Richard Andrew x6422-Oct-08 17:58
professionalRichard Andrew x6422-Oct-08 17:58 
GeneralRe: How to close running application before uninstallation?? Pin
tarunclassic22-Oct-08 19:54
tarunclassic22-Oct-08 19:54 
QuestionDLL preferred load address Pin
George_George22-Oct-08 3:34
George_George22-Oct-08 3:34 
AnswerRe: DLL preferred load address Pin
Simon P Stevens22-Oct-08 3:48
Simon P Stevens22-Oct-08 3:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.