Lab Exercise 3
Lab Exercise 3
1. Create a four-function calculator for fractions. Here are the formulas for the four
arithmetic operations applied to fractions:
The user should type the first fraction (two values a and b), an operator, and a second
fraction (two values c and d). The program should then display the results in fraction i.e.
(Numerator/ denominator).
2. Write a menu driven program (using switch-case) to create a database of student names
and perform the following operations using array of character pointers and dynamic
memory allocation.
b. To delete a name (Show Error message if zero names are there in database)
Note: your program should keep on showing above three options until user enters ‘N’.
3. Given an array A of size N-1 and given that there are numbers from 1 to N with one
element missing; Write program to find the missing number.
5. Write a function that finds the minimum and the maximum value in an array of N integers.
Inputs to the function are the array of integers, an integer variable containing the length of
the array and references to integer variables that will contain the minimum and the
maximum values. The function prototype is:
void minmax( int array[], int length, int& min, int & max);
6. Write a program to find Kth smallest and Kth largest element in an unsorted array.
Input:
A[]=4, 5, 60, 70, 33, 44
K=2
Output:
2nd smallest number is 5 and 2nd largest number is 60
Input:
A[]=2, 46, 56, 68, 3, 34, 489, 457, 4545, 100
K=5
Output:
5th smallest number is 56 and 5th largest number is 68
a. https://www.hackerrank.com/challenges/pointer-in-c/problem?isFullScreen=true
b. https://www.hackerrank.com/challenges/students-marks-
sum/problem?isFullScreen=true
c. https://www.hackerrank.com/challenges/too-high-
boxes/problem?isFullScreen=true