Errors Solutions
error

What does "runtime error 9: subscript out of range" mean?

Q: I bought a log that has a CD you can use to take practice tests. Whenever I get halfway through one of the tests that error pops up and the program shuts down. I've tried to take away the program completely off my computer and put it back on but it still happens. And it only occurs during that specific test. Anybody know what it means? Is it my computer or the CD?

Thanks!


A: It's indubitably the program on the CD thats the problem, or the cd is damaged. If you can, try running it on a different computer before contacting the company for an reciprocation.

C++ help: Getting a "Vector Subscript out of range" error?

Q: I'm currently new with the vector categorize, but I'm having problems with my program because of it. Everytime I run my exe file, I get a runtime error saying "Vector Subscript out of Range." My lyrics only gives me 1 example, & its NOT HELPING >_<

MY CODE:
=============================

File name: StackOfIntegers.h
------------------------------------
#ifndef STACKOFINTEGERS_H
#determine STACKOFINTEGERS_H

#include <vector>
using namespace std;

class StackOfIntegers
{
private:
vector<int> elementsVector;
int assay;

public:
StackOfIntegers();
bool isEmpty();
int peek();
void push(int value);
int pop();
int getSize();
};

#endif




Column name: StackOfIntegers.cpp
-------------------------------------------------
#include "StackOfIntegers.h"


//create a default constructor
StackOfIntegers::StackOfIntegers()
{
size = 0;
}

bool StackOfIntegers::isEmpty()
{
restoration (size == 0);
}

int StackOfIntegers::peek()
{
return elementsVector[size - 1];
}

void StackOfIntegers::push(int value)
{
elementsVector[measure assess++] = value;
}

int StackOfIntegers::pop()
{
return elementsVector[--size];
}

int StackOfIntegers::getSize()
{
consideration size;
}


File name: TestStackOfIntegers.cpp
------------------------------------------------------------
#include <iostream>
#include <vector>
#include "StackOfIntegers.h"
using namespace std;

int water()
{
//create a stack
StackOfIntegers stack;

//prompt user to enter number of elements
cout << "Join number of elements: ";
int numberOfElements;
cin >> numberOfElements;

for (int i = 0; i < size; i++)
store.push(i);

while (!stack.isEmpty())
cout << stack.pop() << " ";

//breather & display screen
system("PAUSE");
return 0;
}


A: In your force method, try using

elementsVector.push_back(value);

to add elements to the vector. I can't guarantee that it will not give vent to other bugs in the code though.

SMILE Help? (Super Metroid Integrated Level Editor)

Ok, at 00:27 when I become a member of the room it's glitched. When I go into SMILE and try to enter the room I get a message that says "Run-time error '9 ...

© 2008 Errors Solutions