Article View: csu.cs.200
Article #119Pretty odd
From: douglas jackson
Date: Sun, 18 Oct 1998 00:00
Date: Sun, 18 Oct 1998 00:00
30 lines
975 bytes
975 bytes
If I push the numbers 1, 2, 3, 4, and 5, onto a stack called Stck1, in that order (i.e. 5 is on the top of the stack), and then I print them using Pop and Top, I get some weird results. If I loop over this print statement: cout <<Stck1.Top_STK()<<Stck1.Pop_STK()<<endl; I get 45 34 23 12 331 with the "33" being a trash number. If I loop over this statement: cout <<Stck1.Top_STK(); cout <<Stck1.Pop_STK()<<endl; I get 55 44 33 22 11 which is what you would expect. Is there some sort of order of operations in a cout statement with classes?
Technical Details
Message-ID:
<70d0pc$b8k2@yuma.ACNS.ColoState.EDU>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 127144,fbb7bbb1a356abdf,start X-Google-Attributes: gid127144,public From: jacksond@alain.cs.colostate.edu ( douglas jackson) Subject: Pretty odd Date: 1998/10/18 Message-ID: <70d0pc$b8k2@yuma.ACNS.ColoState.EDU> X-Deja-AN: 402504447 Organization: Colorado State University, Fort Collins, CO 80523 Newsgroups: csu.cs.200