std::vector does have an operator[] so my code could be rewritten asI think the OP suggested that his data was comma deliminated so that was what I assumed. In real life it might be necessary to parse the input file differently.
Code:
// now print out // for every a in v for(unsigned i = 0 ; i < v.size() ; i++) { // for every b in a for(unsigned j = 0; j < v[i].size(); j++) std::cout << v[i][j] << " "; std::cout << "\n"; }
Statistics: Posted by RogerW — Sun Feb 04, 2024 5:53 pm