c++ excel cell blank cells
#include <iostream> #include <fstream> #include <sstream> #include <vector> int main() { std::fstream file("myfile.txt"); std::vector<std::string> vec; if(file.is_open()) { std::string line; bool Skip = true; while(std::getline(file, line)) { std::stringstream sstr(line); std::string word; while (std::getline(sstr, word, ' ')) { if(!word.empty()) vec.emplace_back(word); else if(word.empty() && Skip) { vec.emplace_back("NaN"); Skip = false; } } Skip = true; } file.close(); } for(size_t i = 0; i < vec.size(); ++i) { std::cout << vec[i] << " "; if((i+1)%3 ==0) std::cout << std::endl; } return 0; }