Skip to content

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—helpful for B.Sc. CSIT, BIT, BCA, BIM students.

License

Notifications You must be signed in to change notification settings

upendrakda/Object-Oriented-Programming-CPP-Lab-Sheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Object-Oriented Programming in C++ – Lab Sheets

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.


📄 Lab Sheet 1 – Basics and Arithmetic

  1. Test if a number is a multiple of 5.
  2. Test if a number is a multiple of 5 or 11.
  3. Test if a number is a multiple of 5 and 11.
  4. Test if a number is a multiple of 5 but not 11.
  5. Find the sum of squares of the digits of a number.
  6. Perform basic arithmetic operations (add, subtract, multiply, divide) on two numbers.
  7. Convert seconds into hours, minutes, and seconds.
  8. Calculate total marks and percentage from marks of five subjects.
  9. Find roots of a quadratic equation.
  10. Check if a year is a leap year.

📄 Lab Sheet 2 – Numbers, Conditions & Conversions

  1. Find the sum of digits of a four-digit number.
  2. Find the largest of three numbers (without using if).
  3. Check if one number is a multiple of another.
  4. For three numbers: Calculate the sum, average, largest, and smallest.
  5. Compute area and perimeter of a rectangle.
  6. Calculate area and circumference of a circle.
  7. Swap two numbers.
  8. Convert Celsius to Fahrenheit.
  9. Calculate simple interest and amount (using P, T, R).
  10. Check if a number is an Armstrong number.

📄 Lab Sheet 3 – Loops and Series

  1. Find the second largest (middle) among three numbers.
  2. Convert a character to uppercase or lowercase.
  3. Print ASCII values of all characters.
  4. Display the series: ½, 2/3, ¾, ..., (n−1)/n.
  5. Evaluate the series: S = 1 + 2×1 + 3×2 + ... + N×(N−1).
  6. Find GCD and LCM of two numbers.
  7. Count digits in a number.
  8. Find sum of digits of a number.
  9. Reverse a number.
  10. Print squares and cubes of the first 10 natural numbers.

📄 Lab Sheet 4 – Arrays and Classes

  1. Fill and print an array with the sequence: 1, -2, 3, -4, ..., -30.
  2. Merge two arrays into a third one using loops.
  3. Check if an array is sorted in ascending order.
  4. Create a class Number with two integers and a function to return the larger one.
  5. Create a class Number with three integers and a function to return the largest.
  6. Create a class Swapper with two integers and a function to swap them.

📄 Lab Sheet 5 – Operator Overloading & Inline Functions

  1. Subtract two complex numbers using operator overloading.
  2. Add two Time objects using operator overloading.
  3. Subtract two Time objects using operator overloading.
  4. Count number of words in a line.
  5. Find cube of an integer using inline function.
  6. Convert Celsius to Fahrenheit.

📄 Lab Sheet 6 – Inheritance & Conversion

  1. Derive Wall_clock from Clock class and create objects.
  2. Find square of an integer using inline function.
  3. Convert feet to meter.
  4. Calculate area of rectangle using inline function.

📄 Lab Sheet 7 – Inheritance & Geometry

  1. Derive Triangle and Rectangle from Shape and display area.
  2. Find square root of an integer using inline function.
  3. Convert inch to centimeter.
  4. Find volume of rectangular box using inline function.

📄 Lab Sheet 8 – File Handling

  1. Read and write employee records to file emp.doc.
  2. Write 5 item records to item.dat file.
  3. Read 1st, 3rd, and 5th records from item.dat.
  4. Count number of objects in a file.
  5. Copy contents of one file to another.
  6. Write 1000 numbers to even.dat or odd.dat based on parity.

🎯 Happy Coding!

About

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—helpful for B.Sc. CSIT, BIT, BCA, BIM students.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages