This repository contains C++ lab sheets and solutions for Object-Oriented Programming (OOP) in the second semester of BSc. CSIT under Tribhuvan University.
Topics include classes, inheritance, polymorphism, file handling, and more. These lab sheets are useful for students of BSc. CSIT, BIT, BCA, and BIM.
- Test if a number is a multiple of 5.
- Test if a number is a multiple of 5 or 11.
- Test if a number is a multiple of 5 and 11.
- Test if a number is a multiple of 5 but not 11.
- Find the sum of squares of the digits of a number.
- Perform basic arithmetic operations (add, subtract, multiply, divide) on two numbers.
- Convert seconds into hours, minutes, and seconds.
- Calculate total marks and percentage from marks of five subjects.
- Find roots of a quadratic equation.
- Check if a year is a leap year.
- Find the sum of digits of a four-digit number.
- Find the largest of three numbers (without using
if). - Check if one number is a multiple of another.
- For three numbers: Calculate the sum, average, largest, and smallest.
- Compute area and perimeter of a rectangle.
- Calculate area and circumference of a circle.
- Swap two numbers.
- Convert Celsius to Fahrenheit.
- Calculate simple interest and amount (using P, T, R).
- Check if a number is an Armstrong number.
- Find the second largest (middle) among three numbers.
- Convert a character to uppercase or lowercase.
- Print ASCII values of all characters.
- Display the series: ½, 2/3, ¾, ..., (n−1)/n.
- Evaluate the series: S = 1 + 2×1 + 3×2 + ... + N×(N−1).
- Find GCD and LCM of two numbers.
- Count digits in a number.
- Find sum of digits of a number.
- Reverse a number.
- Print squares and cubes of the first 10 natural numbers.
- Fill and print an array with the sequence: 1, -2, 3, -4, ..., -30.
- Merge two arrays into a third one using loops.
- Check if an array is sorted in ascending order.
- Create a class
Numberwith two integers and a function to return the larger one. - Create a class
Numberwith three integers and a function to return the largest. - Create a class
Swapperwith two integers and a function to swap them.
- Subtract two complex numbers using operator overloading.
- Add two
Timeobjects using operator overloading. - Subtract two
Timeobjects using operator overloading. - Count number of words in a line.
- Find cube of an integer using inline function.
- Convert Celsius to Fahrenheit.
- Derive
Wall_clockfromClockclass and create objects. - Find square of an integer using inline function.
- Convert feet to meter.
- Calculate area of rectangle using inline function.
- Derive
TriangleandRectanglefromShapeand display area. - Find square root of an integer using inline function.
- Convert inch to centimeter.
- Find volume of rectangular box using inline function.
- Read and write employee records to file
emp.doc. - Write 5 item records to
item.datfile. - Read 1st, 3rd, and 5th records from
item.dat. - Count number of objects in a file.
- Copy contents of one file to another.
- Write 1000 numbers to
even.datorodd.datbased on parity.
🎯 Happy Coding!