Click here to Skip to main content
15,921,467 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: User Input Pin
Harold_Wishes7-Jul-06 5:51
Harold_Wishes7-Jul-06 5:51 
GeneralRe: User Input Pin
Zac Howland7-Jul-06 6:04
Zac Howland7-Jul-06 6:04 
GeneralRe: User Input Pin
Harold_Wishes7-Jul-06 7:06
Harold_Wishes7-Jul-06 7:06 
GeneralRe: User Input Pin
Zac Howland7-Jul-06 7:33
Zac Howland7-Jul-06 7:33 
GeneralRe: User Input Pin
Harold_Wishes7-Jul-06 10:08
Harold_Wishes7-Jul-06 10:08 
GeneralRe: User Input [modified] Pin
Zac Howland7-Jul-06 10:35
Zac Howland7-Jul-06 10:35 
GeneralRe: User Input [modified] Pin
Harold_Wishes8-Jul-06 17:36
Harold_Wishes8-Jul-06 17:36 
GeneralRe: User Input Pin
Zac Howland9-Jul-06 14:28
Zac Howland9-Jul-06 14:28 
Harold_Wishes wrote:
Will I need to overload the << operator to output each element of the data object to the screen?


You don't need to per se, but you could. Either way, you should create a print method that looks like either of the following:

// operator<< overload
ostream& operator<<(ostream& os, const data& dta)
{
	os << dta.Length.c_str() << endl
	   << dta.Sequence.c_str() << endl
	   << dta.N_Terminal.c_str() << endl
	   << dta.C_Terminal.c_str() << endl;
	return os;
}

// option 1:  print without overload
void print(const data& dta)
{
	cout << dta.Length.c_str() << endl
	     << dta.Sequence.c_str() << endl
	     << dta.N_Terminal.c_str() << endl
	     << dta.C_Terminal.c_str() << endl << endl;	
}

// option 2:  print with overload
void print(const data& dta)
{
	cout << dta << endl;
}

// use for_each to print entire list of items
for_each(g_DataList.begin(), g_DataList.end(), print);


If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac
QuestionSimple MAPI Outlook outbox problem Pin
chilituna7-Jul-06 4:45
chilituna7-Jul-06 4:45 
Questionostream operator link error Pin
mosu'7-Jul-06 4:33
mosu'7-Jul-06 4:33 
AnswerRe: ostream operator link error [modified] Pin
Viorel.7-Jul-06 4:45
Viorel.7-Jul-06 4:45 
AnswerRe: ostream operator link error Pin
Zac Howland7-Jul-06 5:11
Zac Howland7-Jul-06 5:11 
QuestionRun an application inside another one Pin
xtof737-Jul-06 4:03
xtof737-Jul-06 4:03 
AnswerRe: Run an application inside another one Pin
Sarath C7-Jul-06 4:25
Sarath C7-Jul-06 4:25 
GeneralRe: Run an application inside another one Pin
Zac Howland7-Jul-06 4:30
Zac Howland7-Jul-06 4:30 
GeneralRe: Run an application inside another one Pin
Sarath C7-Jul-06 4:39
Sarath C7-Jul-06 4:39 
AnswerRe: Run an application inside another one Pin
Jun Du7-Jul-06 4:40
Jun Du7-Jul-06 4:40 
QuestionCListCtrl and Graphic Pin
ensger7-Jul-06 3:44
ensger7-Jul-06 3:44 
AnswerRe: CListCtrl and Graphic Pin
Zac Howland7-Jul-06 5:25
Zac Howland7-Jul-06 5:25 
GeneralRe: CListCtrl and Graphic Pin
ensger7-Jul-06 9:10
ensger7-Jul-06 9:10 
QuestionCreating a Bitmap from a Framegrabber Image Pin
im797-Jul-06 3:41
im797-Jul-06 3:41 
AnswerRe: Creating a Bitmap from a Framegrabber Image Pin
Justin Tay7-Jul-06 6:27
Justin Tay7-Jul-06 6:27 
AnswerRe: Creating a Bitmap from a Framegrabber Image Pin
im799-Jul-06 4:37
im799-Jul-06 4:37 
GeneralRe: Creating a Bitmap from a Framegrabber Image Pin
Justin Tay9-Jul-06 11:40
Justin Tay9-Jul-06 11:40 
GeneralRe: Creating a Bitmap from a Framegrabber Image Pin
im7910-Jul-06 21:43
im7910-Jul-06 21:43 

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.