   What is this all About!?
  Hello,Ok, so I was creating a little basic program with the basics of STL and algorithms. I got no errors in my code ( oh yeah [smile] ), but when it runs, a error message box pops up and gives me an error. Its strange because the program runs fine, but the box still pops up... (the box pops up while my program is running)Here is a picture of the error box that pops up: Error MessageHere is my Code:#include <ctime>#include <string>#include <vector>#include <iostream>#include <algorithm>using namespace std;int _tmain(int argc, _TCHAR* argv[]){vector<string> power;power.push_back("Mind Control");power.push_back("Super Strength");vector<string> item;item.push_back("Knife");item.push_back("Pipe");item.push_back("Gernades");vector<string>::iterator iter;vector<string>::const_iterator cIter;cout << "\nPowers:" << endl << endl;for(cIter = power.begin(); cIter != power.end(); cIter++){cout << "* " << *cIter << endl;}cout << "\nYou were awarded a New Super Power!" << endl;power.insert(power.begin(), "Telikanesis");cout << "Powers:" << endl << endl;for(cIter = power.begin(); cIter != power.end(); cIter++){cout << "* " << *cIter << endl;}cout << "\nOh No! One of your powers have been absorbed!" << endl;power.erase(power.begin() + 1);cout << "\nPowers: " << endl << endl;for(cIter = power.begin(); cIter != power.end(); cIter++){cout << "* " << *cIter << endl;}cout << "\nYour Items List is:" << endl << endl;for(cIter = item.begin(); cIter != item.end(); ++cIter){cout << "* " << *cIter << endl;}cout << "\nBoth List were put together: " << endl << endl;vector<string> allAbilities(item.size() + power.size());merge(power.begin(), power.end(), item.begin(), item.end(), allAbilities.begin());cout << "All Abilities:" << endl << endl;for(cIter = allAbilities.begin(); cIter != allAbilities.end(); cIter++){cout << "** " << *cIter << endl;}cout << "\nOpps! Evil Minions have Stolen ALL Your Abilities!!!" << endl << endl;allAbilities.clear();if(allAbilities.empty()){cout << "\nYou Have No Abilities!" << endl << endl;}else{for(cIter = allAbilities.begin(); cIter != allAbilities.end(); cIter++){cout << "** " << *cIter << endl << endl;}}cout << "Press Enter to Exit";cin.get();return 0;}
  I don't have an answer, sorry. But, when you use power.insert(..stuff..) is that supposed to put the powers in alphabetical order?Also why bother putting the lists together? the allAbilities list doesn't affect the powers or items lists, from what i saw. so wouldn't just be easier to list both vectors?also is the merge supposed to put the powers and items in some sort of order automatically; or do you have to do that manually? cuz that could be the only reason i can see that the algorithm lib would say: sequence not ordered.   ;  The text in your image is too small to read, which sort of defeats the purpose of posting it in the first place.   ;  It's hard to see, but it looks like an error that happens when you run a VC++ app on a computer without the runtimes installed. On the contrary that wouldn't make much sense as you'd have them after installing VC++.Maybe the debug part would have something to do with it?   ;Quote:Original post by SiCraneThe text in your image is too small to read, which sort of defeats the purpose of posting it in the first place.I don't have an answer either, but with the 800x600 resolution on the computer I am using, you can just barely make out that the error message says:Debug Assertion Failed!Program:...File: c:\program files\microsoft visual studio 8\vc\include\algorithmLine: 2238Expression: sequence not orderedFor information on how your program can cause an assertion failure, see theVisual C++ documentation on Asserts.(Press Retry to debug the application)Just wanted to post that so anyone having trouble reading it could now read it and maybe help the OP out.-AJ   ;  std::merge expects ordered sequences/containers.   ;Quote:Original post by u235Quote:Original post by SiCraneThe text in your image is too small to read, which sort of defeats the purpose of posting it in the first place.I don't have an answer either, but with the 800x600 resolution on the computer I am using, you can just barely make out that the error message says:Debug Assertion Failed!Program:...File: c:\program files\microsoft visual studio 8\vc\include\algorithmLine: 2238Expression: sequence not orderedFor information on how your program can cause an assertion failure, see theVisual C++ documentation on Asserts.(Press Retry to debug the application)Just wanted to post that so anyone having trouble reading it could now read it and maybe help the OP out.-AJ- Thanks for psoting that. When i uploaded the picture, it was much bigger.BTW, thanks for all the help everybody.[Edited by - NUCLEAR RABBIT on June 17, 2006 1:13:23 PM];  see, the odd thing is i can read every word on that error message...   ;Quote:Original post by Silvosee, the odd thing is i can read every word on that error message...me to :]   