Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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;
}
Comment

PREVIOUS NEXT
Code Example
C :: trie tableau c 
C :: color text in C 
C :: run time in c 
C :: pi in c language 
C :: clear screen c 
C :: c distance between 2 points 
C :: boolean in c 
C :: docker container give usb access 
C :: arduino serial read write structure 
C :: octave dot operator 
C :: scanf ignore new line 
C :: tainted love 
C :: add border to image android 
C :: windeployqt example 
C :: printf c float 
C :: array loop in c 
C :: c round function 
C :: what is covert channel 
C :: check prime number or not c 
C :: check if string in string c 
C :: typedef in c 
C :: callback c++ c 
C :: c code to add two numbers 
C :: c program to find the frequency of all characters in a string 
C :: c check first character of string 
C :: c language string 
C :: c programming 
C :: casting in c 
C :: fseek function in c 
C :: mediawiki upload size 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =