More Dang Deque Problems

I'm new to using deques and other advanced containers like vectors and such. I don't see anything wrong with this but I get the weird "Runtime stopping in a weird way" error at the first for loop.

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
troopFile.open("Troops Number.txt");

            deque<string> names;
            string nameInput;
            int typeNum;
            int nameCounter = 0;
            int typeCounter = 0;
            int monsterCounter = 0;
            int numberCounter = 0;

            deque<string> monsters;
            string monsterInput;

            deque<int> troopNum;
            int numberInput;

            cout << "Please type the name of who owns the troops: ";
            getline(cin,nameInput);
            names.push_back(nameInput);

            cout << "How many types of troops are to be entered for this user: ";
            cin >> typeNum;
            cin.ignore();

            while(typeCounter < typeNum)
            {
                cout << "Please type the name of the troop or monster: ";
                getline(cin,monsterInput);
                monsters.push_back(monsterInput);
                cout << "Please type the number of " << monsters.at(monsterCounter) << " that " << names.at(nameCounter) << " owns: ";
                cin >> numberInput;
                cin.ignore();
                typeCounter++;
                monsterCounter++;

            }

            nameCounter = 0;
            monsterCounter = 0;
            numberCounter = 0;

            for (int nameCounter = 0; nameCounter < names.size(); ++nameCounter)  //ERROR
            {
                troopFile << names.at(nameCounter) << endl;
                for (int i = 0; i < typeNum; ++i)
                    troopFile << monsters.at(monsterCounter) << " - " << troopNum.at(numberCounter) << endl;
            }
the weird "Runtime stopping in a weird way" error at the first for loop.


I'm unfamiliar with this error.

Can you post the actual error you're getting?
The error I get happens while the console is running. The program reaches the specified for loop and then Windows error thing comes up and says, "Counter has stopped working". In the console window it says, "This application has requested the Runtime to terminate in an unusual way. Please contact the application's support team for more information."

I don't even know what a Runtime is. haha
You need to run it with the debugger.
okay. i did. then i ran it again without debugger and it crashed again :( NOTE: it worked perfectly with debugger
Topic archived. No new replies allowed.