Hello guys,
The question is: "How does while(win) actually work?". I am trying to figure out how it works for few days and still no results.
--try
{ double val=0;
cout<<"Welcome!\n";
while (cin) {
Token t = ts.get();
if (t.kind == 'q') break; // 'q' for quit
if (t.kind == ';') // ';' for "print now"
cout << "=" << val << '\n';
else
ts.putback(t);
val = expression();
}
How can ts.get() look ahead? and how does it evaluate after each loop?
For example, "2+5" ? I thought firstly it reads "2", ts.get(), check 2 "if" conditions, putback and call expression().
So, expression should return 2!(1 loop execution) but it somehow can read next 2 characters.
I don't understand how cin or while(cin) works. Any suggestions will be appreciated!
Thanks in advance!
You received this message because you are subscribed to the Google Groups "PPP-public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ppp-public+unsubscribe@googlegroups.com.
To post to this group, send email to ppp-p...@googlegroups.com.
Visit this group at https://groups.google.com/group/ppp-public.
For more options, visit https://groups.google.com/d/optout.