?
Solved

what does ' cout <<   << ' do??

Posted on 1997-07-08
5
Medium Priority
?
233 Views
Last Modified: 2010-04-10
I need to know what does  ' cout <<  << ' do?  
I am using it to print a linked list.  
0
Comment
Question by:kellyjj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Expert Comment

by:byoung
ID: 1164486
cout << "Variable foobar = " << foobar << endl;
say foobar = 5, then on the screen it would print out:
Variable foobar = 5
if you're using it to print a linked list to the screen, put a loop(for or while or the like) around the cout command and increment which part of the linked list you print each time thorugh the outer loop.  Therefore producing a printout of your linked list.  Good Luck!
0
 

Accepted Solution

by:
bradz earned 20 total points
ID: 1164487
The cout comand returns itself! if that makes it clear!?!?

So << << shouldn't do anything -> may be syntax error

If you want to print a list you should overload the cout << operator.

want the code??

bradz

0
 
LVL 2

Author Comment

by:kellyjj
ID: 1164488
bradz,  e mail me.  kellyj@r2d2.bpginc.com.  I don't what you mean, "cout returns itself".  do you mean it is recursive.?

and thanks for the linked list answer.  A head node, after all that I have done and I did not think of that,   boy I am a homer.
0
 

Expert Comment

by:cbcb
ID: 1164489
I'm new to this forum, but I was jsut wondering what was wrong with the first answer?  If it's wrong, I shouldn't be expert status because it seems totally correct to me.  I'm I wrong?
0
 

Expert Comment

by:bradz
ID: 1164490
are you still having a problem with this one??
all of these answers seem correct??

bradz
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question