0% found this document useful (0 votes)
97 views14 pages

Output

The document contains 20 programs demonstrating different data structures and algorithms. Program 1-5 demonstrate basic concepts like area calculation, grade calculation, Fibonacci series, inheritance, and patient billing. Program 6-10 demonstrate linear search, bubble sort, selection sort, and merging arrays. Program 11-15 demonstrate matrix multiplication, string operations, file handling, and binary files. Program 16-20 demonstrate stack and queue implementations using arrays and linked lists for customer, player, and city management.

Uploaded by

Hari krishna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views14 pages

Output

The document contains 20 programs demonstrating different data structures and algorithms. Program 1-5 demonstrate basic concepts like area calculation, grade calculation, Fibonacci series, inheritance, and patient billing. Program 6-10 demonstrate linear search, bubble sort, selection sort, and merging arrays. Program 11-15 demonstrate matrix multiplication, string operations, file handling, and binary files. Program 16-20 demonstrate stack and queue implementations using arrays and linked lists for customer, player, and city management.

Uploaded by

Hari krishna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Program-1

Different shape:
1. Cuboid
2. Rectangle
3. Square
4. Exit
Enter your choice: 1
Enter the L, B and H (respectively):20 30

40

Your area is: 5200


Different shape:
1. Cuboid
2. Rectangle
3. Square
4. Exit
Enter your choice: 2
Enter the L and B: 43

67

Your area is: 2881


Different shape:
1. Cuboid
2. Rectangle
3. Square
4. Exit
Enter your choice: 3
Enter the side: 13.5
Your area is: 182.5
Program-2
Enter the rollno:101
Enter the name: Shilpa
Enter the total mark: 491
Enter the grade: A
Name: Shilpa
Rollno: 101
Total Mark: 491
Grade:A
Program-3
Enter the fibonacci limit: 10
The series is:
0
1
1
2
3
5
8
13
Program-4
Program using inheritance
1. Simple Interest
2.Compound Interest

21

34

Accept Choice 1
Enter Account Number: 17534
Enter Principal:

10000

Enter Rate of Interest: 2


Enter Year:
3
Invoked account class
Invoked class simple's constructor
Account no:
17534
Principal:
10000
Rate of interest:
2
Duration:
3
Interest:
600
Destructor of class account
Wish to Continue
y
1. Simple Interest
2.Compound Interest
Accept Choice 2
Enter Account Number: 53646
Enter Principal:

15000

Enter Rate of Interest: 5


Enter Year:
2
Invoked account class
Invoked class compound's constructor
Account no:
-11890
Principal:
15000
Rate of interest:
5
Duration:
2
Interest:
1537.5
Destructor of class account
Wish to Continue n

Program-5
Enter Patient's Name: Karthikka
Enter Patient's Age: 17
Enter the no. of days Patient Stay: 3
Enter the problem the Patient is suffering from: Fever
Enter Patient's Address: 21 Nehru st., Hosur
Patient's Name: Karthikka
Patient's Age: 17
No. of days Patient Stays: 3
Total Charge is: 3000
Illness is: Fever
Patient's Address is: 21 Nehru st., Hosur
Program-6
Enter desired array size (max.50)...
9
Enter array elements
45
78
33
12
24
98
86
69
50
Enter element to be searched for...86
Element found at Index: 6, Position: 7

Program-7
Enter desired array size (max50)...12
Enter array elements (must be in Ascending Order)...
10
20
30
40
50
60
70
80
90
100
110
120
Enter element to be searched for...30
Element found 2, Position: 3

Program-8
How many elements do u want to create array with?(max.50)...8
Enter array elements...
24
90
76
543
45
12
10
52
Array
Array
Array
Array
Array
Array
Array

after
after
after
after
after
after
after

pass-1-is:
pass-2-is:
pass-3-is:
pass-4-is:
pass-5-is:
pass-6-is:
pass-7-is:

10
10
10
10
10
10
10

90
12
12
12
12
12
12

76
76
24
24
24
24
24

543
543
543
45
45
45
45

The sorted array is as shown below...


10 12 24 45 52 76 90 543

45
45
45
543
52
52
52

12
90
90
90
90
76
76

24
24
76
76
76
90
90

52
52
52
52
543
543
543

Program-9
Program using Bubble sort
Enter how many number of city names:
3
Enter the City Names:
mumbai
delhi
chennai
1.Bubble Sort 2.Exit
Enter choice(1 or 2): 1
chennai mumbai
chennai delhi
chennai delhi
Wish to continue:

delhi
mumbai
mumbai
n

Program-10
How many elements do u want to create array with?(max.50)...7
Enter aray elements..
97
16
76
33
15
85
53
Array
Array
Array
Array
Array
Array
Array

after
after
after
after
after
after
after

pass-1-is:
pass-2-is:
pass-3-is:
pass-4-is:
pass-5-is:
pass-6-is:
pass-7-is:

97
16
16
16
15
15
15

16
97
76
33
16
16
16

76
76
97
76
33
33
33

33
33
33
97
76
76
53

The sorted array is as shown below..


15 16 33 53 76 85 97

15
15
15
15
97
85
76

85
85
85
85
85
97
85

53
53
53
53
53
53
97

Program-11
How many elements do u want to create first array with?(maX50)...5
Enter first array elements [ascending]...
11
22
33
44
55
How many elements do u want to create second array with?(max50)..7
Enter second array elements [descending]...
75
65
55
45
35
25
15
The Merged array is as shown below..
11 15 22 25 33 35 44 45

55

55

65

75

Program-12
Input Row & Column of A Matrix: 2 3
Input Row & Column of B Matrix: 3 2
Matrices can be multiplied.
Input Matrix-A:
2
4
6
8 10 12
Input Matrix-B:
1
3
5
7
9 11
Product of A & B Matrices:
76
100
166
226

Program-13
String operations using pointers.
1. Find Length. 2. Copy String. 3. Reverse

4. Join String.

Enter choice: 1
Enter string: Object Oriented Program
23
Do you want to continue...y
1. Find Length. 2. Copy String. 3. Reverse

4. Join String.

Enter choice: 2
Enter string: C++
C++
Do you want to continue...y
1. Find Length. 2. Copy String. 3. Reverse

4.Join String.

Enter choice: 3
Enter string: India
aidnI
Do you want to continue...y
1. Find Length. 2. Copy String. 3. Reverse

4. Join String.

Program-14
Program using Text File
Enter the String:
Continue...

Enter the String:


Continue...

All are Indians

Object oriented Programming

Enter the String:

Keyboard

Continue...
n
All are Indians
Object oriented Programming
Keyboard
No. of lines starting with A or a:
Total no. of vowels:

18

No. of three letter words:

Program-15
Program using Binary File
1. Write Sports details 2.Write Athletic
3. Display Athletics
Enter choice... 1
Enter Event and Athlet Name: Football
Hendry
Continue(y/n)...? y
Enter Event and Athlet Name: athletic
Usain Bolt
Continue(y/n)...? n
Do u want to continue...? y
Program using Binary File
1. Write Sports details 2.Write Athletic
3. Display Athletics
Enter choice... 2
Do u want to continue...? y
Program using Binary File
1. Write Sports details 2.Write Athletic
3. Display Athletics
Enter choice... 3
Event: athletic
Athlet Name: Usain Bolt
Do u want to continue...? n

Program-16
Program using stack as an array of objects
1. Push 2. Pop 3. Display
Enter choice... 1
Enter the customer no. 1234
Enter the customer Name:

Chethan

Enter the customer Age: 25


Continue:
y
1. Push 2. Pop 3. Display

Enter choice... 1

Enter the customer no. 2313


Enter the customer Name:

Ravendar

Enter the customer Age: 35


Continue:
y
1. Push 2. Pop 3. Display
Customer no:

Enter choice... 3

1234

Name: Chethan
Age:

25

Customer no:

2313

Name: Ravendar
Age:

35

Continue:
y
1. Push 2. Pop 3. Display
Customer no:

Enter choice... 2

2313

Name: Ravendar
Age:

35

Continue:
y
1. Push 2. Pop 3. Display
Customer no:

1234

Name: Chethan
Age:

25

Continue:

Enter choice... 3

Program-17
1.Push 2.Pop 3.Display
Enter your Choice:
1
Enter the values of C_no. & C_Name:123
Madhu
Wish to Continue...
y
1.Push 2.Pop 3.Display
Enter your Choice:
1
Enter the values of C_no. & C_Name:342
Dharshana
Wish to Continue...
y
1.Push 2.Pop 3.Display
Enter your Choice:
1
Enter the values of C_no. & C_Name:234
Sahana
Wish to Continue...
y
1.Push 2.Pop 3.Display
Enter your Choice:

Customer No.: 234


Customer Name: Sahana
Customer No.: 342
Customer Name: Dharshana
Customer No.: 123
Customer Name: Madhu
Wish to Continue...
y
1. Push 2.Pop 3.Display
Enter your Choice:
2
Customer No.: 234
Customer Name: Sahana
Wish to Continue...y
1. Push 2.Pop 3.Display
Enter your Choice:
3
Customer No.: 342
Customer Name: Dharshana
Customer No.: 123
Customer Name: Madhu
Wish to Continue...
Program-18
//Linear Queue

Enter Item for Insertion: 5


Queue is5
To Insert more Elements(y/n): y
Enter Item for Insertion: 10
Queue is5<-

10

To Insert more Elements(y/n): y


Enter Item for Insertion: 15
Queue is5<-

10<-

15

To Insert more Elements(y/n): y


Enter Item for Insertion: 20
Queue is5<-

10<-

15<-

20

To Insert more Elements(y/n): n


Deletion
Now the Queue is:
10<- 15<- 20
Want to delete more elements (y/n)...y
Now the Queue is:
15<- 20
Want to delete more elements (y/n)...n

Program-19
Program using queue as linked list
1.insert 2.delete 3.display
Enter the choice:1
Enter the values for pincode and name
001
Chennai
Try again:y
1.insert 2.delete3.display
Enter choice:1
Enter the values for pincode and name
002
Madurai
Try again:y
1.insert 2.delete3.display
Enter choice:3
Pincode:1
Name of the city : Chennai
Pincode:2
Name of the city : Madurai
Try again:y

1.insert 2.delete3.display
Enter choice:2
Try again:y
1.insert 2.delete3.display
Enter choice:3
Pincode:2
Name of the city : Madurai

Program-20
1. Insert
2.Delete
Enter Your Choice:
1
Enter Player Id:
Continue...(y/n)...?

10

Continue...(y/n)...?

11

Continue...(y/n)...?

Enter Player Name:

Madhu

3.Display

4.Exit

Enter Player Name:

Sahana

1.Insert
2.Delete
Enter Your Choice:
1
Enter Player Id:

4.Exit

1. Insert
2.Delete
Enter Your Choice:
1
Enter Player Id:

3.Display

12
y

3.Display

4.Exit

Enter Player Name:

Sapna

1. Insert
2.Delete
Enter Your Choice:
3
Player ID:
10
Player ID:
11
Player ID:
12

3.Display

4.Exit

Player name: Madhu


Player name: Sahana
Player name: Sapna

Continue...(y/n)...? y
1. Insert
2.Delete
Enter Your Choice:
2
Player Id:
10
Continue...(y/n)...?

3.Display

4.Exit

Player Name:

Madhu

1. Insert
2.Delete
Enter Your Choice:
3

3.Display

4.Exit

Player ID:

11

Player Name:

Sahana

Player ID:

12

Player Name:

Sapna

Continue...(y/n)...?

You might also like