Thread: Runtime error

  1. #1
    Village id10t
    Join Date
    May 2008
    Posts
    57

    Runtime error

    Hello everybody,

    I think i am having a problem with my compiler(or with my logic) since yesterday whenever I use a loop (for, while, do...while) the program gives the error:

    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.

    I am using Dev-C++ version 4.9.8.3 on Windows Vista Ultimate.

    I include the source code of my latest confussion:

    Code:
    string ExpandString(string Sentence)
    {
       
       int centerpos;
       
           for(int i=Sentence.size();Sentence.size()<40;i++)
           { 
                  string tinystring=Sentence.substr(centerpos,1);
                  Sentence.insert(centerpos,tinystring);
                  centerpos--;
                  tinystring=Sentence.substr(centerpos,1);
                  Sentence.insert(centerpos,tinystring);
           }
           
           return Sentence;     
    }

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    just a wild guess -
    centerpos is used uninitialized (you didn't give it a value before using it)

  3. #3
    Village id10t
    Join Date
    May 2008
    Posts
    57
    Brilliant Cyberfish!!! Seems I have been high on something for the last two days... all my loops were nuts.. Thnks again

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM