Friday, August 2, 2013

Read data into c++

Newsgroup: comp.lang.c++

Subject: Read data into c++

From: axcytz@...

Date: Thu, 1 Aug 2013 17:17:44 -0700 (PDT)



Hi all,



I have a data that looks like this:



1,2,3

1,3,4

2,4

1

2,4,5,6



I have these data in an excel file but can also copy into a txt file. I have declared a vector in c++ and want to read these data into my c++ code. For small problems, I typed it manually in my c++ code as:



int init1[] = {1,2,3};

std::vector<int> row1( init1, init1+sizeof(init1)/sizeof(init1[0]));

P.push_back(row1);



int init2[] = {1, 3, 4};

std::vector<int> row2( init2, init2+sizeof(init2)/sizeof(init2[0]));

P.push_back(row2);



and so on.



How can I import these data from txt or excel file?



Thanks









via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?56461-Read-data-into-c&goto=newpost

View all the progranning help forums at:

http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums

No comments:

Post a Comment