I want to convert text file into HTML tables but can't create columns.It inputs the whole data into rows.As you can see in the picture there are no separate columns for each section.
#include<iostream>
#include<fstream>
#include<string>
#include<conio.h>
using namespace std;
void main()
{
ifstream x;
string name;
string head = "<!DOCTYPE html>\n<html>\n<head> <style> table, th, td { border: 1px solid black; } </style> </head><body>\n<table>";
string tail = "</table></body>\n</html>";
string bodystart = "<tr><td>\n";
string bodyclose = "</td></tr>";
ofstream y;
x.open("example.txt",std::ios::app);
y.open("myhtmlfile.html");
y << head;
while (getline(x, name)){
y << bodystart << name <<bodyclose;
}
y << tail;
x.close();
}