Bath-24-Programming-Assignment-C++
Bath-24-Programming-Assignment-C++
ASSIGNMENT #3
BDS-1C
Question #1: Tic-Tac-Toe Game
Description:
Create a C++ program that allows two players to play a game of Tic-Tac-Toe. Use a 2D
array to represent the game board. Implement functions to:
Requirements:
Sample Input:
Sample Output:
Current Board:
X | O |
---------
| |
---------
| |
15 Marks
Develop a C++ program that validates a completed Sudoku puzzle using a 2D array. The
program should check whether the Sudoku solution is valid by ensuring that each row, each
column, and each of the nine 3x3 subgrids contain all digits from 1 to 9 exactly once.
Requirements:
Sample Input:
Sample Output:
15 Marks
Question #3: Exam Score Analyzer with File Handling
Description:
Extend Assignment 1, Question 5 by incorporating file handling and functions. The program
should:
1. Input: Read exam scores for three students from a file named scores.txt . Each
student has five exam scores.
2. Calculate Averages: Compute the average score for each student.
3. Determine Highest Average: Identify which student(s) have the highest average.
4. Write Results: Save the analysis to a file named results.txt .
5. Handle Ties: Appropriately handle cases where multiple students share the highest
average.
Requirements:
Student1 85 90 78 92 88
Student2 80 85 89 91 87
Student3 90 93 88 87 92
20 Marks
OPTIONAL:
Question #4: Dungeon Explorer – Treasure Hunt Game
Description:
Design a C++ program that simulates a treasure hunt in a dungeon using 2D arrays and
functions. The program should:
Requirements:
Sample Interaction:
Treasures Collected: 5
Treasures Collected: 5
...
25 Marks
OPTIONAL:
Question #5: Library Book Tracker
Description:
Develop a C++ program that manages a library's book inventory using file handling and
functions. The program should allow librarians to:
1. Add New Books: Input book details and save them to a file books.txt .
2. View All Books: Read and display all books from books.txt .
3. Search for a Book: Find books by title or author.
4. Delete a Book: Remove a book from the inventory.
5. Update Book Information: Modify details of an existing book.
Requirements:
Sample Input:
Choose an option:
1. Add New Book
2. View All Books
3. Search for a Book
4. Delete a Book
5. Update Book Information
6. Exit
Enter choice: 1
Sample Output:
Choose an option:
1. Add New Book
2. View All Books
3. Search for a Book
4. Delete a Book
5. Update Book Information
6. Exit
Enter choice: 2
Book Inventory:
ISBN: 978-3-16-148410-0, Title: C++ Programming, Author: Bjarne Stroustrup,
Quantity: 10
25 Marks