Click here to Skip to main content
15,905,427 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: About a time event Pin
Fredrik Skog28-Sep-03 23:46
Fredrik Skog28-Sep-03 23:46 
GeneralRe: About a time event Pin
FlyingDancer29-Sep-03 0:33
FlyingDancer29-Sep-03 0:33 
Generaldirect draw and multimon problem Pin
gwenael28-Sep-03 22:07
gwenael28-Sep-03 22:07 
Generalgraphics query Pin
coda_x28-Sep-03 21:54
coda_x28-Sep-03 21:54 
QuestionAccelerator keys in modeless Dialog? Pin
Brian van der Beek28-Sep-03 21:53
Brian van der Beek28-Sep-03 21:53 
AnswerRe: Accelerator keys in modeless Dialog? Pin
Phil J Pearson29-Sep-03 2:50
Phil J Pearson29-Sep-03 2:50 
GeneralRe: Accelerator keys in modeless Dialog? Pin
Brian van der Beek29-Sep-03 2:59
Brian van der Beek29-Sep-03 2:59 
General"string" problem. Pin
WREY28-Sep-03 21:39
WREY28-Sep-03 21:39 
I feel my computer is playing a cat and mouse game with me, and I am the one losing. Here's why!

I can enter a bunch of strings and it can read one and ignore the rest, (meaning, it'll only give me the first one that it read), or it can read ALL, but give me NOTHING (meaning, it'll hang in the loop)!! Here's the code.
string str;
vector<string> vStr;
do
{
   cin>> str;
   vStr.push_back(str);
   cout<<"\n Size: " <<vStr.size();  //will show the vector growing
} while(str.end()!="\r");
======================
vector<string>::iterator iterB = vStr.begin(), iterE = vStr.end();
for(; iterB!=iterE; ++iterB)
    cout<< *iterB <<" ";
======================
cout<<"\n" <<endl;
The condition shown in the 'while' statement, will show the vector growing as strings are entered, but WILL NOT exit the 'do/while' loop.

However, if I were to change the condition in the 'while' statement to:
while(str.end()=="\r");
It'll exit the loop, but will ONLY give me the first string it read.

Ideally, I would like for it to read all the strings entered, and report all that it accumulated in the vector.

Thanks for any help.

Confused | :confused:

William

Fortes in fide et opere!
GeneralRe: &quot;string&quot; problem. Pin
ZoogieZork28-Sep-03 23:22
ZoogieZork28-Sep-03 23:22 
GeneralRe: &quot;string&quot; problem. Pin
Joaquín M López Muñoz28-Sep-03 23:25
Joaquín M López Muñoz28-Sep-03 23:25 
GeneralRe: &quot;string&quot; problem. Pin
WREY29-Sep-03 8:14
WREY29-Sep-03 8:14 
GeneralRe: &quot;string&quot; problem. Pin
Joaquín M López Muñoz29-Sep-03 9:33
Joaquín M López Muñoz29-Sep-03 9:33 
GeneralRe: &quot;string&quot; problem. Pin
WREY29-Sep-03 9:45
WREY29-Sep-03 9:45 
GeneralRe: "string" problem. Pin
Joaquín M López Muñoz29-Sep-03 9:50
Joaquín M López Muñoz29-Sep-03 9:50 
GeneralRe: "string" problem. Pin
WREY29-Sep-03 10:07
WREY29-Sep-03 10:07 
GeneralRe: &quot;string&quot; problem. Pin
David Crow29-Sep-03 5:42
David Crow29-Sep-03 5:42 
GeneralRe: &quot;string&quot; problem. Pin
WREY29-Sep-03 8:34
WREY29-Sep-03 8:34 
GeneralRe: &quot;string&quot; problem. Pin
David Crow29-Sep-03 9:38
David Crow29-Sep-03 9:38 
GeneralRe: &quot;string&quot; problem. Pin
WREY29-Sep-03 9:53
WREY29-Sep-03 9:53 
GeneralSEC_WINNT_AUTH_IDENTITY_EXW Pin
Bernhard28-Sep-03 20:58
Bernhard28-Sep-03 20:58 
GeneralNT service stop event Pin
Aqualic28-Sep-03 20:55
Aqualic28-Sep-03 20:55 
GeneralClipboard content as bitmap Pin
Thoppae28-Sep-03 20:47
Thoppae28-Sep-03 20:47 
Generalabout CListCtrl Pin
muddog28-Sep-03 20:37
muddog28-Sep-03 20:37 
GeneralRe: about CListCtrl Pin
chifor28-Sep-03 20:53
chifor28-Sep-03 20:53 
GeneralRe: about CListCtrl Pin
Abin28-Sep-03 22:19
Abin28-Sep-03 22:19 

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.