If you build with debug information included, it should tell you the line of your code that leads to this assertion failing.
However, that might not be enough, because this error indicates that at some point you are writing over some memory that you shouldn't be, and you're destroying some information the compiler put there to keep track of memory that was allocated by new, and this error only arises when it goes looking for that data, only to find that you've trashed it.
namespace CISP430_A2
{
class sequence
{
public:
// TYPEDEFS and MEMBER CONSTANTS
typedef double value_type;
typedef size_t size_type;
enum { CAPACITY = 30 };
// CONSTRUCTOR
sequence(size_type entry=CAPACITY );//done
// COPY CONSTRUCTOR
sequence(const sequence& entry); //done
// Library facilities used: cstdlib
// MODIFICATION MEMBER FUNCTIONS
void start( );//done
void advance( );//done
void insert(const value_type& entry); //done
void attach(const value_type& entry);
void remove_current( );//done
void resize(size_type );//done
void sequence::operator =(const sequence&);//done
// CONSTANT MEMBER FUNCTIONS
size_type size() const;//done but not sure
bool is_item( ) const;//done
value_type current( ) const;//done
//Destructor
~sequence() ;//done
private:
value_type *data; // pointer to dynamic array
size_type used; //how much of array is being used
size_type capacity; //current capacity of the bag
size_type current_index;
};
}
#endif
#include <cctype> // Provides toupper
#include <iostream> // Provides cout and cin
#include <cstdlib> // Provides EXIT_SUCCESS
#include "sequence2.h" // With value_type defined as double
#include <cassert>
using namespace std;
using namespace CISP430_A2;
namespace CISP430_A2
{
sequence::sequence (size_type entry) //the default constructor, entry tells how many items to allocate for the dynamic array
{
data = new value_type[entry];//193
capacity = entry;
used = 0;
current_index = 0;
}
sequence::sequence(const sequence& entry) // the amount of memory allocated for entry determines how much memory to allocate for the new dynamic array
{
data = new value_type[entry.capacity];
current_index = entry.current_index;
capacity = entry.capacity; //193
used = entry.used;
copy (entry.data , entry.data + used , data);
}
void sequence::start()
{
current_index = 0;
}
void sequence::advance()
{
if (is_item())
current_index++;
}
void sequence::insert(const value_type& entry)//194
{
used ++;
if (used == capacity)
resize(used*1.1); //resizing by 10%
*(data+current_index) = entry;
cout << "\n insert value " << *(data+current_index) << " is the index " << current_index<< endl;
used = used*1.1;
advance();
}
'A2.exe': Loaded 'C:\Users\MONA\Documents\cisp430\projects\A2\Debug\A2.exe', Symbols loaded.
'A2.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Program Files\BitDefender\BitDefender 2011\Active Virus Control\Midas_00087_015\midas32.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Program Files\BitDefender\BitDefender 2011\Active Virus Control\Midas_00087_015\plugin_base.m32', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Program Files\BitDefender\BitDefender 2011\Active Virus Control\Midas_00087_015\plugin_nt.m32', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Program Files\BitDefender\BitDefender 2011\Active Virus Control\Midas_00087_015\plugin_registry.m32', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Program Files\BitDefender\BitDefender 2011\Active Virus Control\Midas_00087_015\plugin_extra.m32', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Program Files\BitDefender\BitDefender 2011\Active Virus Control\Midas_00087_015\plugin_net.m32', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Program Files\BitDefender\BitDefender 2011\Active Virus Control\Midas_00087_015\plugin_fragments.m32', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'A2.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'A2.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Program Files\BitDefender\BitDefender 2011\Antispam32\pchook32.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcr90.dll', Cannot find or open the PDB file
'A2.exe': Loaded 'C:\Windows\SysWOW64\profapi.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x20a4) has exited with code -1073741510 (0xc000013a).
The thread 'Win32 Thread' (0x2010) has exited with code -1073741510 (0xc000013a).
The thread 'Win32 Thread' (0x21cc) has exited with code -1073741510 (0xc000013a).
The program '[7300] A2.exe: Native' has exited with code -1073741510 (0xc000013a).
In your code, it is possible for the member used to be equal to capacity in the normal course of events. See sequence::attach.
Inspect sequence::insert and see how that might be a problem. Also, note that (aside from the atrocious use of doubles to scale your sizes) you're effectively setting used in that function to capacity which kind of makes increasing capacity by 10% pointless.