代码如下,
#include <iostream>
#include <fstream>
#include <string>
int main()
{
std::ofstream of;
of.open("./tmp.csv");
of << "name" << "," << "age" << "," << "gender" << std::endl;
of << "Zhangsan" << "," << "3" << "," << "male" << std::endl;
of << "Lishi" << "," << "4" << "," << "male" << std::endl;
of.close();
return 0;
}
产出为,
待补充…