Erasing with Vectors

I'm getting an assertation error when I try to compile this code. It's coming from the erase function regarding the vectors. What's going on?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <iostream>
#include <vector>
#include <string>

using std::vector;




int main(int argc, char** argv)
{
	std::string input;
	vector<int> vector1;
	int a;
	int b;
	
	std::cin >> input;
	

	while (input == "insert" || "remove" || "print")
	{
		if (input == "insert")
		{
			std::cout << "Insert what number?" << std::endl;
			std::cin >> a;
			vector1.push_back(a);
			std::cin >> input;
		}
		else if (input == "remove")
		{
			std::cout << "Remove what number? " << std::endl;
			std::cin >> b;
			for (int m = 0; vector1.size(); m++)
			{
				int r = 0;
				if (vector1[m] == b)
				{
					vector1.erase(vector1.begin() + r);
				}
				r++;
			}
			std::cin >> input;
		}
		else if (input == "print")
		{	
			int a;
			int temp;
			for (int k = 0; k < vector1.size(); k++)
			{
				for (int j = 0; j < vector1.size() - 1; j++)
				{
					if (vector1[j]>vector1[j + 1])
					{
						temp = vector1[j];
						vector1[j] = vector1[j + 1];
						vector1[j + 1] = temp;

					}

				}
			}
			for (int i = 0; i < vector1.size(); i++)
			{	
				a = vector1[i];
				std::cout << a << std::endl;
			}
			std::cin >> input;
		}
	}





	system("PAUSE");
	return 0;
}
Found my error. Problem in the for loop regarding the parameters.
Topic archived. No new replies allowed.