IAD Lab 1

Problem Statement

Consider the table shown in Figure 1 and Code Listing 1. Try to develop a solution of the following problem:

Write code using C/C++ which performs following tasks:
a) Prompt the user to enter number of columns?
b) Prompt the user to enter number of rows?
c) Get data cell by cell from user using a loop?
d) Generate an HTML page to display above data in a table?
e) Store the page in a folder on desktop.

Figure 1

HTML Table Preview

Code Listing

<!DOCTYPE html>
<html>
<head>
<style>
table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

td, th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {
  background-color: #dddddd;
}
</style>
</head>
<body>

<h2>HTML Table</h2>

<table>
  <tr>
    <th>Company</th>
    <th>Contact</th>
    <th>Country</th>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
  </tr>
  ...
</table>

</body>
</html>

Report

Output

Live Demonstration

Web hosting by Somee.com