📌  相关文章
📜  如何将逗号分隔的文件读入数组 c++ 代码示例

📅  最后修改于: 2022-03-11 14:44:47.762000             🧑  作者: Mango

代码示例1
#include 
#include 
#include 
#include 

int main()
{
    std::ifstream inFile("registration.txt");
    if (inFile.is_open())
    {
        std::string line;
        while( std::getline(inFile,line) )
        {
            std::stringstream ss(line);

            std::string ID, fname, lname;
            std::getline(ss,ID,',');    std::cout<<"\""< enrolled;
            std::string course;
            while( std::getline(ss,course,',') )
            {
                 enrolled.push_back(course); std::cout<<", \""<