CPS 3525 project 2 demo -
C++, file I/O, recursion, HTML FORM & cgi using GET method
Using a C++ program to do the followings
- Receive two kinds of inputs:
- Must use HTML FORM GET method.
- Web inputs from browser including two text areas, web sample page is here), the following are the web requirements:
- 1st object text data area: a textarea, 20 cols, and 15 rows
- 2nd object text data area: a textarea, 20 cols, and 15 rows
- a button to upload a text file - the 2nd object text data
- Click here to see sample files and details.
- Show corresponding error message in red color under each entry in the output,
- record client's information (IP, browser, OS, etc), the timestamp that the cgi program was executed.
- Here is the details of the input object data:
- The data should have two parts - header (first row) and data (after the first row).
- The header is the first row and it should have two numbers separated by a comma. The first number is the height (number of records), and the 2nd number is width (number of characters). Every data row should have the same number of char.
- 'B' means the background char, 'T' means the target char (object).
- You cannot hardcode the width and height in the program. The size of the array should be flexible.
- sample file 1
- sample file 2
- sample file 3
- Must implement your own recursive method in C++, and call it from your project.
- You must use C++, not any other languages for the backend program.
- Use the same recursive method to process the input object data
- use the 4-connected method - that means if a 'T' char is connected with its immediate neighbor (left, up, right, down) that is also a 'T', they are considered the same object.
- In the sample file, the first object starts at (1,1) with size=2, 2nd object starts at (5,1) with size=1, the 3rd object starts at (3,3) with size=4. There are three 4-connected objects based on the 'T' char.
- recognize the number of objects,
- count the size of each object for each input
- report the visiting details in correct order
- identify which input (1st or 2nd textarea) has more objects and the object size,
- save these information to a text file,
- First line: course id and YOUR name.
- 2nd line: the current local time in the format yyyy-mm-dd hh:mm:ss
- Show the web inputs, each web input is one line, and the validation error should be under each input
- A separated line to separate web user information from the results
- The 1st area and the 2nd textarea should have its own result. For each result:
- There is a header to show the object text data source (Web or file)
- Indicate the width and height
- Display the original input object text data
- Display the visiting details
- For each object, display the sequence #, starting position and size
- Display the number of objects
- Display which source has more objects and the size
- display the output text file html link on the browser.
Note: Your program should:
- have good coding style - comments, indentations, meaningful variable names
- minimize the global variables
- modularize the program
- reduce the redundant codes
- improve the performance