Update ida.cpp

add delete, fixed logic error, added returns