Monday, December 25, 2023

Bharathiar University C++ lab Programs pdf for BCA Bsc CS IT CT DA ML AI

 Bharathiar University  lab Programs for BCA Bsc CS IT CT DA ML AI

C++ lab programs  

click here to download


Bharathiar University

Programming in C++ Lab

BCA / BSc CS/ IT/ DA/ ML/CT

 

S.No

Program

Page number

1

Write a C++ Program to create a class to implement the data structure STACK. Write a constructor to initialize the TOP of the STACK. Write a member function PUSH() to insert an element and member function POP() to delete an element check for overflow and underflow conditions..

3

2

Write a C++ Program to create a class ARITHMETIC which consists of a FLOAT and an INTEGER variable. Write member functions ADD (), SUB(), MUL(), DIV() to perform addition, subtraction, multiplication, division respectively. Write a member function to get and display values

10

3

. Write a C++ Program to read an integer number and find the sum of all the digits until it reduces to a single digit using constructors, destructors and inline member functions

15

4

Write a C++ Program to create a class FLOAT that contains one float data member. Overload all the four Arithmetic operators so that they operate on the object FLOAT

19

5

Write a C++ Program to create a class STRING. Write a Member Function to initialize, get and display stings. Overload the operators ++ and == to concatenate two Strings and to compare two strings respectively.

23

6

Write a C++ Program to create class, which consists of EMPLOYEE Detail like E_Number, E_Name, Department, Basic, Salary, Grade. Write a member function to get and display them. Derive a class PAY from the above class and write a member function to calculate DA, HRA and PF depending on the grade.

28

7

Write a C++ Program to create a class SHAPE which consists of two VIRTUAL FUNCTIONS Calculate_Area() and Calculate_Perimeter() to calculate area and perimeter of various figures. Derive three classes SQUARE, RECTANGLE, TRIANGE from class Shape and Calculate Area and Perimeter of each class separately and display the result.

36

8

Write a C++ Program to create two classes each class consists of two private variables, a integer and a float variable. Write member functions to get and display them. Write a FRIEND Function common to both classes, which takes the object of above two classes as arguments and the integer and float values of both objects separately and display the result.

40

9

Write a C++ Program using Function Overloading to read two Matrices of different Data Types such as integers and floating point numbers. Find out the sum of the above two matrices separately and display the sum of these arrays individually.

43

10

Write a C++ Program to check whether the given string is a palindrome or not using Pointers.

49

11

Write a C++ Program to create a File and to display the contents of that file with line numbers.

51

12

Write a C++ Program to merge two files into a single file.

57


Friday, December 15, 2023

Program 6- Working with loops in R R Programming Lab - Bsc CS DA and BSC ML And AI -Bharathiar University -

 

B.Sc Computer Science  

R Programming - Lab  

Bharathiar University 

Program 6

Loops in R

Program 6- Write a R program to demonstrate various types of loops

SOURCE CODE:

# R program to demonstrate loops


# application of for loop

week <- c('Sunday',

          'Monday',

          'Tuesday',

          'Wednesday',

          'Thursday',

          'Friday',

          'Saturday')



for (day in week)

{

  print(day)

}


# R program to demonstrate the use of while loop


x = 1

while (x <= 5)

{


  cat("2 x ", x,"=", x*2,"\n")

  x = x + 1

}


# R program to illustrate

# the application of repeat loop


i <- 0

repeat

{

  print("Basic to pro tamil!")

  i = i + 1

  if (i == 5)

  {    

    break

  }

}



OUTPUT:

Monday, December 11, 2023

Program 5- List and operators R Programming Lab - Bsc CS DA and BSC ML And AI -Bharathiar University -

 

B.Sc Computer Science  

R Programming - Lab  

Bharathiar University 

Program 5

List and Operators

Program 5- Write a R program to perform various operations on lists

SOURCE CODE:

# R program for lists

# Create a list 

rollno <- c(10,11,12)

name <- c("ram","rocky","raj")

marks <- c(98,99,80)

rank <- c('B','A','C')

student <- list(rollno, name, marks, rank)


# Print the original list

print("Original List:")

print(student)


# naming the original list

print("Original List with names:")

names(student) <- c("Roll number", "Name", "Marks", "Rank")

print(student)



# Accessing elements in the list

print("Accessing third element:")

print(student[3])  


# Accessing fourth element with name in the list

print("Accessing fourth element with name:")

print(student$Rank)  



# Adding an element to the list  

print("Adding an element:")

student[5] <- "Bsc IT"

print(student)


# updating an element to the list  

print("updating last element:")

student[5] <- "Bsc CS"

print(student)


# Calculating the length of the list

print("Length of the list:")

student_length <- length(student)

print(student_length)



# Removing an element from the list

print("Removing an element:")

student <- student[-5]  # Remove the fifth element

print(student)



Sample Output:

Program 12 BCA Madras University BCA Object Oriented Programming using C++ Practical Madras University Program 12 Implement a telephone directory using files

  BCA Object Oriented Programming using C++ Practical Madras University  Program 12  Implement a telephone directory using files SOURCE CODE...