HTML Table

Company Contact Country
Alfreds Futterkiste Maria Anders Germany
Centro comercial Moctezuma Francisco Chang Mexico
Ernst Handel Roland Mendel Austria
Island Trading Helen Bennett UK
Laughing Bacchus Winecellars Yoshi Tannamuri Canada
Magazzini Alimentari Riuniti Giovanni Rovelli Italy
• The C++ code for the given problem is given as: #include #include using namespace std; int main() { int rows, cols; // Prompt the user to enter the number of columns cout << "Enter the number of columns: "; cin >> cols; // Prompt the user to enter the number of rows cout << "Enter the number of rows: "; cin >> rows; // Get data cell by cell from the user string data[rows][cols]; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { cout << "Enter data for row " << i+1 << ", column " << j+1 << ": "; cin >> data[i][j]; } } // Generate HTML page ofstream htmlFile; htmlFile.open("C:\\Users\\HF\\Desktop\\table.html"); // Change YourUsername to your actual username htmlFile << "\n"; htmlFile << "\n"; htmlFile << "\n"; htmlFile << "\n"; htmlFile << "\n"; htmlFile << "\n"; htmlFile << "

HTML Table

\n"; htmlFile << "\n"; htmlFile << "\n"; for (int j = 0; j < cols; j++) { htmlFile << "\n"; } htmlFile << "\n"; for (int i = 0; i < rows; i++) { htmlFile << "\n"; for (int j = 0; j < cols; j++) { htmlFile << "\n"; } htmlFile << "\n"; } htmlFile << "
Column " << j + 1 << "
" << data[i][j] << "
\n"; htmlFile << "\n"; htmlFile << "\n"; htmlFile.close(); cout << "HTML table created and saved to desktop." << endl; return 0; }