Note that there are some explanatory texts on larger screens.

plurals
  1. POLoop iteration issue c++
    primarykey
    data
    text
    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;vector&gt; #include &lt;sstream&gt; using namespace std; int main() { string line; ifstream infile ("Input.csv"); vector&lt;string&gt; table; string word; if(infile.is_open()) { getline(infile,line); istringstream iss(line); while(!iss.eof()) { getline(iss,word, ','); table.push_back(word); } } for(int index=0; index&lt;11; ++index) { cout&lt;&lt; "Element" &lt;&lt; index &lt;&lt; ":" &lt;&lt; table.at(index) &lt;&lt; endl ; } infile.close(); } </code></pre> <p>In the above program I am reading values from input file and splitting based on comma and finally storing the values into a vector.</p> <p>when I print vector I am able to view only the first line of input file.</p> <p>Input file:</p> <pre><code> CountryCode,Country,ItemCode,Item,ElementGroup,ElementCode,Element,Year,Unit,Value,Flag 100,India,3010,Population - Est. &amp; Proj.,511,511,Total Population - Both sexes,1961,1000,456950, 100,India,3010,Population - Est. &amp; Proj.,511,511,Total Population - Both sexes,1962,1000,466337, 100,India,3010,Population - Est. &amp; Proj.,511,511,Total Population - Both sexes,1963,1000,476025, 100,India,3010,Population - Est. &amp; Proj.,511,511,Total Population - Both sexes,1964,1000,486039, </code></pre> <p>Output: </p> <pre><code> Element0:CountryCode Element1:Country Element2:ItemCode Element3:Item Element4:ElementGroup Element5:ElementCode Element6:Element Element7:Year Element8:Unit Element9:Value Element10:Flag </code></pre> <p>Problem: Only 1st line is being printed</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload