# Thread: "exited due to signal 10 (sigbus)"

1. ## "exited due to signal 10 (sigbus)"

the code I'm using is:

Code:
```//vect.h
//does vector math

#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <sstream>

using namespace std;
using std::string;

class vect {
public:

vector <float> vector1;
vector <float> vector2;
string vectorsWhole[2];
bool last;
int choice;
int vectIndex[2];
char func;
float scalar;
vector <float> vectorEQ;

bool notLastElement(string num){

if(num.substr(num.length()-2,num.length()-1)=="l"){

return false;

}else{

return true;

}//end if

}//end last element

void vec(){

int i=0;

cout<<"Enter vector 1, hit enter after each element, and end your last element with \"L\":\n";

do{

i++;

for(i=0;i<vector1.size();i++){

}//end for

}//end vec

};//end class```
the only thing that has to do with this code in the main cpp file is the calling of method vec

as I said in the title, as soon as vec is called, there's about a 5 second delay where you can enter data and then it "exits due to signal 10 (sigbus)"

any help

We went over this before, and it's the same problem with a different disguise. You can't access nonexistent elements of a vector. Because inread is an empty vector, using the subscript operator will always fail and after you increment i, you're still looking out into limbo. Since you're adding items to the end in a linear fashion, do this instead:
Code:
```string in;

do {
cin>> in;