I'm trying to get a vector of string from input to create a graph , but i don't know why in middle my code it crashes. please help me fix it. I use Visual Studio.
#include <iostream>
#include <vector>
#include <iterator>
void main(void)
{
    {
        using namespace std;
        int8_t n{ 0 };
        cout << "enter the size of graph : ";
        cin >> n;
        vector<string> graph(n);
        string connectionsWith;
        vector<string>::iterator i;
        string::iterator e;
        int p{ 0 };
        for (i = graph.begin(); i != graph.end(); ++i)
        {
            cout << '\n' << "enter the vertices that are connected to " << p << " : ";
            cin >> connectionsWith;
            graph.push_back(connectionsWith);
            p++;
        }
        p = 0;
        for (i = graph.begin(); i != graph.end(); ++i)
        {
            cout << p << " is connected to " << *i;
            p++;
        }
    }
}
 
     
    