Please help and show/explain all steps in the C++ coding! I would really appreciate it if you could also do the extra credit portion, as well. Thank you!!!
Background HTML (HyperText Markup Language) is used to describe the structure of a web page that you view in any internet browser. It uses a series of start and end tags to specify page elements. For example, the following HTML would create a table with 2 rows and 3 columns:
The
tag signifies the beginning of a table, and
is the end of the table. The beginning and end of a row is specified with
and
, while each individual cell within the table are specified with
and | . Any text that is placed in-between
and | will be displayed within that table cell. The previous example would create an HTML page that looks like the following when viewed in a web browser: ABC DEF Assignment Your assignment is to generate an HTML multiplication table with dimensions specified by the user. You will ask the user for the number of rows then number of columns, and generate an HTML table of the appropriate size. The top left cell should contain the result of 1 x 1, and the bottom right cell should contain the result of num_rows x num_cols. Each row and column may be an integer value between 1 and 12 inclusive (1 or 12 are valid). If the user does not specify a value in this range or a value that is not a valid integer, prompt the user again until you receive a valid value. You should not simply exit the program if invalid input is given. Output Your output messages should match the examples shown below exactly. User input is in red. Each preformatted box is a separate program execution. Enter a number of rows (1-12): 2 Enter a number of columns (1-12): 3
Enter a number of rows (1-12): 1 Enter a number of columns (1-12): 4
Enter a number of rows (1-12): 0 Enter a number of rows (1-12): 13 Enter a number of rows (1-12): ten Enter a number of rows (1-12): 2abc Enter a number of columns (1-12): Enter a number of columns (1-12): -5 Enter a number of columns (1-12): a10 Enter a number of columns (1-12): 2a
Hints / Restrictions 1. If you encounter input that fails to be read into an int (such as a string), make sure to clear the error flags and ignore all remaining characters waiting to be read so you can prompt the user for new input. See slide 15 of 04 Loops.pdf. 2. You do not need to strip off the end of a valid number, such as 2a. The extraction operator will extract 2 and leave a in the stream. 3. Use for loops to iterate through your rows and columns since you know how many iterations you need to go through. 4. Use while loops to read input from the user since you do not know how many times they may provide invalid input. 5. You may not write or call any functions (if you know how). Extra Credit (up to +10 points). Add an extra row and column at the top and far left which contains row and column headers for your multiplication table. The top left cell should contain X to signify that it is a multiplication table. See the example output below: Enter a number of rows (1-12): 2 Enter a number of columns (1-12): 3
Compiling You will compile your C++ program by typing the following command: g++ -std=C++11 -Wall -o lab4 lab4.cpp