reading data from file into a vector??

hi everyone,
so I'm trying to read data from a text file into a vector but the data is like

13 24 12
45 23 12


so it goes as lines and i want to store them in the vector as lines. how will the program understands that it comes to the end of the line and stores each line as a pack? ıs there anything like multidimensional vectors ?? what should I do?
Multi-dimensional vector:
vector<vector<int>> data;

Figuring out how to know when you're at an end-of-line is something you should figure out on your own I would say.
so i've been trying to learn about files and vectors and try to read data from file and transfer it into vector. data consists of 3 columns and 2500 rows of number. but the code below gives error saying one or more multiply defined symbols found which i couldn't understand. what is wrong??
void main()
{
int i,j;
vector<vector<double>>trial(2500,0);
ifstream infile;
infile.open("ambientvars.txt");
if(infile.is_open())
{

for(i=0;i<2500;i++)
{
for(j=0;j<3;j++)
infile>>trial[i][j];
}
}
cout<<trial[0][0]<<" "<<trial[0][1]<<" "<<trial[0][2]<<endl;
system("pause");
}
Please post the complete error message, these messages contain important information for finding the errors.

Also may should be defined to return an int and you should return an int from this function.
1
2
3
4
5
int main()
{

   return 0;
}
some.obj : error LNK2005: _main already defined in nearest neighbors.obj

C:\Users\dell\documents\visual studio 2010\Projects\nearest neighbors\Debug\nearest neighbors.exe : fatal error LNK1169: one or more multiply defined symbols found

these are the errors
You can have one and only one function with the name of main() in the global namespace. You appear to have two. Is the code you provided in nearest neighbors.cpp?

Topic archived. No new replies allowed.