Posts

OOPS LAB : EX NO 11: EXCEPTION HANDLING

                                             USER DEFINED EXCEPTIONS Case Study 1: Online Banking System  (R NO :1 - 5) Scenario: A bank application must prevent invalid withdrawals. Step-by-step Questions: Define a class InsufficientBalanceException derived from exception. Create a BankAccount class with balance as a private member. Write a method withdraw(amount) that: Throws exception if amount > balance. Display a meaningful error message using what(). Write a main() function to: Accept withdrawal amount from user Handle exception using try-catch Extend: Add another exception for minimum balance violation. Case Study 2: Student Result Processing System     (R NO :6 - 10) Scenario: Marks entered should be within valid range. Step-by-step Questions: Create a user-defined except...

Ex No - 10 - Random File Access in C++

  Random File Access - (Files must be read and written randomly) 🔷   1. Student Record Update System     ( RN : 1 TO 5) Problem: Update student marks using roll number. Steps: Define a class for student (roll no, name, marks). Create a binary file and store multiple student records. Accept a roll number from the user. Open file using fstream in read/write mode. Search for the record using roll number. Use seekg() / seekp() to move to correct position. Update the marks. Write the modified record back to file. Display updated record. 🔷  2. Bank Account Management       ( RN : 6 TO 10) Problem: Update balance after withdrawal using account number. Steps: Define account class (account no, name, balance). Store multiple records in binary file. Accept account number and withdrawal amount. Search for matching account. Check sufficient balance. Move file pointer using seekp(). Ded...

Ex no : 9 - Sequential File Access in c++

  Sequential File Access ( Files must be read and write only in sequential order) Merge Two Files  (RN 1 - 10) Write a program to: Create two sequential files containing sorted integers. Merge them into a third file in sorted order (like merge step in merge sort).   Word, Line, Character Counter  (RN 11 - 20) Write a program to: Read a text file sequentially. Count number of words, lines, and characters.   Search in File   (RN 21 - 30) Write a program to: Store product details (id, name, price). Search for a product by ID and display details if found. Update Record in Sequential File  (RN 31 - 45) Write a program to: Store 5 student records. Update marks of a student based on roll number using file rewriting. Student Record Processing  (RN 46 - 61) Write a C++ program to: Create a sequential file of 10 student records (roll, name, marks). Read the file ...