| | |
Assertion Failed
![]() |
•
•
Join Date: Nov 2007
Posts: 227
Reputation:
Solved Threads: 0
Can anyone tell what cause the run time "Debug Assertion Failed!" error message? it has expression: sizeInBytes>count
cpp Syntax (Toggle Plain Text)
int main() { int choice; // for menu choice string option; // for repeat going back to menu option Name name[300]; int i=0; // count do{ cout<<"Welcome!"<<endl; cout<<"1.Get the data"<<endl; cout<<"2.See the data"<<endl; cout<<" 1.forward"<<endl; cout<<" 2.backward"<<endl; cout<<"3.Add someone"<<endl; cout<<"4.Delete someone"<<endl; cout<<"5.Edit an entry"<<endl; cout<<"6.Search for someone"<<endl; cout<<" 1.ID"<<endl; cout<<" 2.last name"<<endl; cout<<"7.Sort the data"<<endl cout<<" 1.ID"<<endl; cout<<" 2.last name"<<endl; cout<<"8.Information about the file"<<endl; cout<<"9.Save"<<endl; cout<<"10.exit"<<endl; cin>>choice; cout<<endl; switch(choice) { case 1: { int id; string lastName, firstName, phone; double amt; ifstream reader; reader.open("names.txt"); while(reader>>id>>lastName>>firstName>>phone>>amt) { name[i].set(id, lastName, firstName, phone, amt); i++; } reader.close(); cout<<"Data read."<<endl; break; } case 2: { int secPick; cout<<"1.forward 2.backward"<<endl; cin>>secPick; if(secPick==1) { showlist(name, i); cout<<endl; } else if(secPick==2) { showlistBackward(name, i); cout<<endl; } else { cout<<"You have entered a wrong option"<<endl; exit(1); } break; } case 3: addName(); break; case 9: save(name, i); //cout<<"Sorry, not yet implemented."; break; case 10: exit(0); default: cout<<"Sorry, this input is not an option"; exit(1); } cout<<"Do you want to go back to the main menu? (Enter yes or no)"; cin>>option; }while(option=="yes" || option=="Yes"); return 0; }
>Can anyone tell what cause the run time "Debug Assertion Failed!" error message?
Usually it means you caused a library function to break by doing something that it's assuming won't happen. This can also happen in your own code if you use assertions (which is rare, sadly). Step through your code to find out where it's throwing the error and you'll be well on your way to figuring out what's wrong.
Usually it means you caused a library function to break by doing something that it's assuming won't happen. This can also happen in your own code if you use assertions (which is rare, sadly). Step through your code to find out where it's throwing the error and you'll be well on your way to figuring out what's wrong.
I'm here to prove you wrong.
Build your program in debug mode, and run in debug mode, you will find exact line which is causing assertion failure.
![]() |
Similar Threads
- Debug Assertion Failure (Web Browsers)
- Assertion Failure? (C++)
- help for error (C++)
- File operations (C)
- MFC Listener (C)
- Debug Assertion Failed (Troubleshooting Dead Machines)
- Deleting a pointer? (C++)
- pls help! programs don't work, scandisk error (Windows 95 / 98 / Me)
Other Threads in the C++ Forum
- Previous Thread: fatal error C1900: Il mismatch between 'P1' version '20060201' and 'P2' version '2005
- Next Thread: Please help me as soon as possible
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ cdialogbar char class classes code coding compile console conversion convert count delete deploy desktop developer directshow dissertations dll double-linkedlist download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker loan loop looping loops map math matrix memory multiple news node number online output pagerank pointer problem program programming project python random read recursion recursive reference risk rpg string strings superclass temperature template test text text-file tree tutorial url validator variable vector video win32 windows winsock wordfrequency wxwidgets






