Assignment 4
Assignment 4
Note:
1. Read the problem statement thoroughly to understand the requirements and constraints.
2. Ensure a clear understanding of what the program is expected to achieve.
3. Organize the code logically with proper indentation, functions and formatting.
4. Display clear and informative output to convey the results of the program.
5. If needed, include comments in the code to explain complex logic or improve code
readability.
6. Before submission, review the code to ensure it meets the requirements and produces the
expected output.
Guidelines for Submission
Scenario:
A company wants to store customer feedback ratings for a product. They do not know in advance
how many ratings they will receive. The ratings are integers between 1 and 5. Each time a customer
gives a rating; it should be added to the array automatically. If the array is full, it should grow to
accommodate more ratings.
Task:
Write a C++ program that:
Scenario:
You are designing a simple image processor. An image is represented as a 2D array of pixel
brightness values (integers between 0 and 255). The processor should:
Task:
Write a C++ program that:
Scenario:
A teacher wants to collect the names of students who are attending an extra class. The number of
students is not known in advance — students keep arriving and writing their names on a list.
Each name should be stored in a vector<string>, which grows automatically as more students are
added.
Task:
Scenario:
A library wants to keep track of the number of books borrowed by each visitor in a day. They
don’t know in advance how many visitors will come. The librarian enters the number of books
borrowed by each visitor one by one.
Scenario:
A small warehouse stores boxes in rows and columns (like shelves). Each cell in a 2D array
represents the number of items in that box. The manager wants:
Task:
Write a C++ program that: