پاسخ داده شده: خواندن فایل اکسل در c++ و تشکیل ماتریس آن
برای راحتی کار ابتدا فایل اکسل را به csv تبدیل کنید(تو خود نرم افزار اکسل) و سپس توسط کد زیر محتوی آن را بخونید:
std::ifstream file(cvs_file_name.c_str(), std::ifstream::in); if (!file) { cout << "No valid input file was given, please check the given filename." << endl; retu -1; } string line; std::vector<std::vector<std::string>> context_data; while (getline(file, line)) { std::vector<std::string> line_data; stringstream row(line); string column; while (getline(row, column, delimiter)) { line_data.push_back(column); } context_data.push_back(line_data); }
