5.2 The program should be menu driven, with the options: Capture Student Marks, Sort the Class List, Display the Class List, Exit.
print the minimum number in the n given integer.
1 <_ N <_ 10
Create a class Shape and two additional classes (each derived from Shape) named Rectangle and Triangle. The member attributes and functions for each class are given below:
Shape:
private:
int width;
int height;
public:
virtual int getArea();
Rectangle:
public:
virtual int getArea();
Triangle:
public:
virtual int getArea();
Driver Program:
Rectangle r1(3,2);
Triangle t1(3,2);
Shape *s1 = &r1;
s1->getArea();
Shape *s2 = &t1;
s2->getArea();
Assume that the cell users are two kinds – those with a postpaid option and those with a prepaid option. Postpaid gives a fixed free talk time and the rest is computed at the rate of N2.90 per pulse. Prepaid cards have a fixed talk time.
Define a class Cell_user as a base class and derive the hierarchy of classes. Define member functions and override them wherever necessary to
(i) retrieve the talk time left for each user.
(ii) print the bill in a proper format containing all the information for the postpaid user.
Write a C++ code to read a line of string as an input and do the following operations. Do proper input validation to your input.
i) Capitalize first and last character of each word in the given string. [3 Marks]
ii) Delete a word from the given string. Popup a message if the string is empty. [5 Marks]
iii) Add a word in the middle of the given string. Capitalize the new word if it already exists.
iv) For proper input validation
Dry run the following code and draw the tree to show how recursion is solved. On writing only
output you will get zero number.
int fun(int a, int b)
{
if (b == 0)
return 0;
if (b % 2 == 0)
return fun(a + a, b/2);
return fun(a + a, b/2) + a;
}
int main()
{
cout << fun(4, 3) ;
return 0;
}
Dry run the following code and draw the tree to show how recursion is solved. On writing only
output you will get zero number.
a) fun1(5)
void fun1(int n)
{
int i = 0;
if (n > 1)
fun1(n - 1);
for (i = 0; i < n; i++)
cout << " * ";
}
Find the minimum and maximum element in doubly linked list using recursion.
Write a recursive function to Reverse the singly linked list and return the head of list.
For Example: head→1→5→6 →8→NULL, after function linked list will become
head→8→6→5→1→NULL
Print the doubly linked list in recursive order.