Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTaishir Tungalag
461 PointsC++ builder How to read float numbers from text file and put into 2d dynamic array
Here is my code
include "string"
include "fstream"
if(!Opendialog1->Execute()) return; String Name = Opendialog1-> FileName;
std::ifstream is(Name.c_str()); if(!is.is_open()) return; std::string s;
while (!is.eof()) { std::getline(is.s); String S=s.c_str(); }
int colcount = StrToInt(Edit1->Text); int rowcount = StrToInt(Edit2->Text); float *array = new float [rowcount] for ( int i =0 ; i<colcount+1; i++) { array[i] = new float [colcount]; }
My .txt file is 0,15 0,3 0,5 0,8 0,9 0,76 0,32 0,45 0,74 0,99 0,34 0,21 0,34 0,45 0,73 0,11 0 0,13 0,89 0,19