Write a program in C++ to read a positive integer number n from a standard input device and to display the number and digit. For example, n = 5678 Output 5 6 7 8 vertically
Write a program to implement the Date class which has three data members named day, month and year.
1. Provide a constructor, which takes arguments (you may set values of data members to 0).
2. Write getter and setter functions (input and show functions) for the Date class.
3. Also write a member function void CompareDates(Date d1, Date d2) which tells which date comes first.
Example output:
13/11/2009 comes before 20/12/2009
Create a class named ‘Rectangle’, Triangle and Square.
Rectangle class:
Data Members: length, width and area
Functions:input() ,area_Calculator()
Square class:
Data Members: length,area
Functions :input() , area_Calculator()
Triangle class:
Data Members: base,hieght,area
Functions :Input() , area_Calculator()
Compare their areas in a friend function and tell which shape has greatest area.
Area of rectangle: length*width;
Area of triangle: ½(base*height);
Area of square: (length)2
Create a class named ‘CalculateArea’ to calculate the area of three different diagrams i.e. Rectangle, Triangle and a Square using function overloading.
First prompt the user to select the diagram for which he wants the area:
Press 1 for Rectangle
Press 2 for Triangle
Press 3 for Square
After the selected option, call the respective function of the selected diagram and print the area.
Area of rectangle: length*width;
Area of triangle: ½(base*height);
Area of square: (length)2
Write a program that creates a class called student. The data members of the class are name and age.
· Create a nullary constructor and initialize the class object.
· Create a parameterized constructor that can set the values being passed from the main function.
· Create a display function called showall( ) which will be used to show values that have been set.
Use the default copy constructor to show that copying of simple objects can be accomplished through the use of the default copy constructor.
Write a Python program that accepts a string and calculate thenumber of digits and letters
Sample Data : Python 3.9
Expected Output :
Letters 6
Digits 2
Write a Python program to convert temperatures to and from celsius, fahrenheit.
[ Formula : c/5 = f-32/9 [ where c = temperature in celsius and f = temperature in fahrenheit ]
Expected
Output :
60°C is 140 in Fahrenheit
45°F is 7 in Celsius
Get the input from the user for the number of rows and columns.
Print 0 in the row one.
Print 1 in the row two.
Case= Test 1
input=
5
5
output=
00000
11111
00000
11111
00000
Write a C++ program to enter salary and output income tax and net salary using multiple inheritance concept.
Note: Use Linked List to implement stack.
A stack is an object that allows the following operations:
Push: Add an element to the top of a stack
Pop: Remove an element from the top of a stack
IsEmpty: Check if the stack is empty
Peek: Get the value of the top element without removing it
Create a class to define above mention operations of stack along with some addition functionality:
i. Copy a stack to another one.
ii. Delete an element at a specified location.
iii. Returns the count of elements in a stack.
iv. Insert an element at a specified location.
Write a main function to test the functionality of above class.
Remember: To access any element that is not at top, you have to first pop all other elements on the top of that.
Note: Use Linked List to implement stack.