CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: [RESOLVED] only works with cout?

    Code:
    // this is the way i fixed it (adding an x <= 99998 to the while loop conditions would work too in most situations)
    // (and I'm only showing what's in the "Main" function to save space)
    
    while(true) //infinite loop
    {
         big[x] = x;
         x = x + 1;
         
         if(x <= 99998)
         {
              cout << "ERROR: array is out of bounds" << endl; // this will pop up as soon as you run the program
              break;
         }
    }
    Sleep(3000);
    <= are you sure? Shouldn't it be > ?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  2. #17
    Join Date
    Apr 2013
    Posts
    34

    Re: [RESOLVED] only works with cout?

    Whoops! good catch!! lol, guess I should copy and paste it next time

  3. #18
    Join Date
    May 2013
    Location
    // Brazil
    Posts
    51

    Re: [RESOLVED] only works with cout?

    show us your solution and donĀ“t forget read this link http://www.mpgh.net/forum/31-c-c-pro...ckeystate.html.

Page 2 of 2 FirstFirst 12

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

Featured