Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>#include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;algorithm&gt; std::vector&lt;std::string&gt; split_string(std::string src, std::string delim) { std::vector&lt;std::string&gt; tokens; std::string tmp = src; size_t i = 0; while (i &lt; tmp.length()) { int oi = i; i = tmp.find(delim, i); if(i != std::string::npos) { tokens.push_back(tmp.substr(oi, i - oi)); } else { tokens.push_back(tmp.substr(oi)); break; } i += delim.length(); } return tokens; } int main(int argc, char* argv[]) { std::ifstream file3("file3.csv"); std::string buf3; std::getline(file3, buf3); file3.close(); std::ifstream file2("file2.csv"); std::string buf2; std::getline(file2, buf2); file3.close(); auto vec3 = split_string(buf3, " "); auto vec2 = split_string(buf2, " "); int size = vec3.size(); for (int n = 0; n &lt; size; n++) { std::cout &lt;&lt; vec3[n] &lt;&lt; " " &lt;&lt; vec2[n]; if (n &lt; size - 1) std::cout &lt;&lt; " "; } return 0; } </code></pre> <p>Ah, original question was updated... OMG</p> <p>Then, next</p> <pre><code>#include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;algorithm&gt; int main(int argc, char* argv[]) { std::ifstream file1("file1.csv"); std::ifstream file2("file2.csv"); std::ofstream out("final.csv", std::ios::app); std::string buf1; std::string buf2; while(file1 &gt;&gt; buf1) { file2 &gt;&gt; buf2; out &lt;&lt; buf1 &lt;&lt; " " &lt;&lt; buf2 &lt;&lt; std::endl; } file1.close(); file2.close(); out.close(); } </code></pre>
    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.
    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