Program stops responding

I don't have any code for this yet. I'm trying to store information from a text file into two separate arrays. The text file is 5 rows and 8 columns with the first word of each row as a name that I am trying to store in one array. The other array is filled with the remaining variables in a 5x7 format. How would I ignore everything in the first column or everything that isn't in the first column?
Last edited on
The same way you would if you weren't ignoring it, except since you're ignoring it there isn't any reason to keep it around.
So that helped a little thanks but now whenever I build and run it the program stops responding after I copy elements into the mpd array. It outputs the information correctly on the screen but then it stops running. Any help appreciated.

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
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <sstream>

using namespace std;

int main()

{
    ifstream inFile;
    string name[5];
    double mpd[5][7];
    string input[5][8];
    int x,y;

    inFile.open("Marathon.txt");
    cout<<"Gathering input data..."<<endl;

    for (y = 0; y < 5; y++){
        for(x = 0; x < 8; x++){
            inFile >> input[y][x];
            cout << input[y][x] << " ";
        }
    cout << " \n";
    }

    for (y = 0; y < 5; y++){
        name[y] = input [y][0];
        cout << name [y] << " \n";
    }

    for (y = 0; y < 5; y++){
        for(x = 1; x < 8; x++){
        stringstream sso;
        sso << input[y][x];
        sso >> mpd[y][x];
        cout << mpd[y][x] << " ";
        }
    cout << "\n";
    }



    inFile.close();

    return 0;
}


This is Marathon.txt file if you needed to know:
Jason 5 3 2 1 3 2 1
Samantha 10 1 1 1 5 1 1
Ravi 3 3 3 3 3 3 3
Sheila 1 2 3 1 2 3 1
Ankit 2 2 2 5 2 2 2
Last edited on
Topic archived. No new replies allowed.