Click here to Skip to main content
15,917,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Kiss for free books Pin
(Steven Hicks)n+129-Dec-02 16:17
(Steven Hicks)n+129-Dec-02 16:17 
GeneralRe: Kiss for free books Pin
Hadi Rezaee30-Dec-02 8:35
Hadi Rezaee30-Dec-02 8:35 
GeneralScrolling with CRichEditCtrl Pin
IGx8929-Dec-02 10:49
IGx8929-Dec-02 10:49 
GeneralRe: Scrolling with CRichEditCtrl Pin
Florin Ochiana29-Dec-02 13:44
Florin Ochiana29-Dec-02 13:44 
QuestionHow to output binary for vector<bool>? Pin
TheWay29-Dec-02 4:36
TheWay29-Dec-02 4:36 
AnswerRe: How to output binary for vector<bool>? Pin
Mike Nordell29-Dec-02 6:11
Mike Nordell29-Dec-02 6:11 
GeneralRe: How to output binary for vector<bool>? Pin
TheWay30-Dec-02 23:03
TheWay30-Dec-02 23:03 
GeneralRe: How to output binary for vector<bool>? Pin
Mike Nordell31-Dec-02 10:10
Mike Nordell31-Dec-02 10:10 
TheWay wrote:
vector vec[Max];
Note: OP intended for it to be vector <bool>

Ehhh, OK. You create an array of 20 vectors, all initially empty. Then you fill each of them with a random number of elements (0-9 to be precise), with the value of the outer loops (i&2) != 0.

There are two issues at hand here:
1) the bool specialization for vector is by many considered an error of the C++ standard (and will probably be removed).
2) Your code makes no sense (to me).

If you really want to output 20 ["something" repeated a randomized number of times], what about just

char mem[10];
for (int i=0; i < 20; ++i) {
  const size_t n = rand()%10;
  if (n) {
    memset(mem, (i&2)!=0, n);
    out.write(mem, n);
  }
}

OK, this code doesn't call rand() for every inner loop like yours did. I don't know if you depended on some property of your C runtime library's rand() function. Feel free to change it to an inner loop with a stochastic loop-termination condition if you really want to confuse any potential readers.
GeneralRe: How to output binary for vector? Pin
TheWay2-Jan-03 0:39
TheWay2-Jan-03 0:39 
QuestionHow to output binary for vector<bool>? Pin
TheWay29-Dec-02 4:35
TheWay29-Dec-02 4:35 
GeneralProblem with losing focus Pin
Joel Holdsworth29-Dec-02 4:11
Joel Holdsworth29-Dec-02 4:11 
GeneralRe: Problem with losing focus Pin
Tim Smith29-Dec-02 4:31
Tim Smith29-Dec-02 4:31 
GeneralRe: Problem with losing focus Pin
Nitron29-Dec-02 16:09
Nitron29-Dec-02 16:09 
GeneralDrawing optimization Pin
S O S29-Dec-02 4:05
S O S29-Dec-02 4:05 
GeneralRe: Drawing optimization Pin
Mike Nordell29-Dec-02 6:16
Mike Nordell29-Dec-02 6:16 
Generaloutput format Pin
wong190729-Dec-02 3:34
wong190729-Dec-02 3:34 
GeneralRe: output format Pin
Joel Holdsworth29-Dec-02 4:07
Joel Holdsworth29-Dec-02 4:07 
GeneralRe: output format Pin
wong190729-Dec-02 4:34
wong190729-Dec-02 4:34 
GeneralRe: output format Pin
Dominik Reichl29-Dec-02 5:19
Dominik Reichl29-Dec-02 5:19 
GeneralRe: output format Pin
Michael Dunn29-Dec-02 5:26
sitebuilderMichael Dunn29-Dec-02 5:26 
GeneralRe: output format Pin
Nick Parker29-Dec-02 16:44
protectorNick Parker29-Dec-02 16:44 
GeneralRe: output format Pin
markkuk29-Dec-02 7:20
markkuk29-Dec-02 7:20 
GeneralDrawObj! Pin
HellShrimp4free28-Dec-02 21:42
HellShrimp4free28-Dec-02 21:42 
GeneralFormat of time Pin
Shah Shehpori28-Dec-02 19:58
sussShah Shehpori28-Dec-02 19:58 
GeneralRe: Format of time Pin
Mike Danberg29-Dec-02 15:17
Mike Danberg29-Dec-02 15:17 

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.