Results 1 to 5 of 5

Thread: What's wrong with this code?

  1. #1
    Ragnar
    Guest

    What's wrong with this code?

    I'm trying to randomize 4 words and then put 3 of them into a editbox.
    My code looks like this:
    Code:
    char c[4][10] = {"Hello","Hi","Good Day","Whatever"};
    
    void CTestingDlg::OnOK() 
    {
    srand((unsigned)time(NULL));
    for (int i=0;i<3;i++) {
    SetDlgItemText(IDC_EDIT1, c[rand() % 4]);
    }
    Now the problem is that the editbox just puts out one line, not 3 as I want.
    I have tried to set "Multiline" and "Want return" but that doesn't work either.

    Can someone please help?

  2. #2
    You didn't close the brace.

  3. #3
    Ragnar
    Guest
    Oh, no I didn't forget to close the brace in my code but it got wrong when I posted it here Sorry...

  4. #4
    It looks fine. Try outputting it to stdout (with printf or cout).

  5. #5
    Ragnar
    Guest
    Yeah i tried to make a console progg and it worked fine. It seems that the editbox is a little messed up or something. It seems that I can't send a couple words to it... it only prints out one

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width