Overload the function find_perimeter() with one, two and three float parameters.
The function with one parameter is used to return the perimeter of the circle. The function with two parameters is used to return the perimeter of the rectangle. The function with three parameters is used to return the perimeter of the triangle. Write the necessary C++ program to test the functionality of above functions.
Write a program using friend function to swap the private data of two classes assuming each class to contain one private integer data member and associated member functions for inputting and displaying the data.
Write a C ++ program to sort given names in alphabetical order
Create a class distance which stores a distance in feet and inches.Input 2 distance values in objects, add them, store the resultant distance in an object and display it.
[Write the above program in two ways.]
a) store the resultant distance in the calling object:C3.add(C1,C2)
b) return the resultant object C3=C1.add(C2)
Create a Date class with three integer instance variables named day,month,year.
It has a constructor with three parameters for initializing the instance variables,and it has one method named daysSinceJan1(). It computes and returns the number of days since January 1 of the same year,including January 1 and the day in the Date object.
For example,if day is a Date object with day=1,month=3,and year=2000,then the calldate.daysSinceJan1() should return 61 since there are 61 days between the dates of January 1,2000,and March 1,2000,including January 1 and March 1. Don’t forget to consider leap years.
Write a Python program that takes a dictionary as an input from the user and then prints the average of all the values in the dictionary.
[You are not allowed to use len() and sum()]
Hint (1): For taking dictionary input
Approach(1): For taking dictionary as an input from the user, you may take the whole dictionary as a string using the input() function. Then you can use the split(), strip() functions and conditions to get the keys and values from the string. Finally, you can make the dictionary using the obtained data.
Approach(2): If the first approach seems too difficult you can create an empty dictionary and then just run a simple loop. For each iteration ask the user for a key and a value using the input() function and keep updating the dictionary with the key and value.
Hint (2): After you have a dictionary, you can use dictionary functions to get all the values from it, run loop to calculate the sum and the total number of values in the dictionary in order to find out the average.
.
In a competition event, five (5) trials are allowed per participant. A scores is awarded and recorded
for each trial. At the end of the trials, simple average of scores is calculated for the final score of the
participant.
If the event has 100 participants:
(1) Write a function to input data for all participants.
(2) Write a function to display the top three (3) participants and their final scores.
C++ program that outputs a triangle pattern using two nested do...while loops.The number of loops should only be two.
C++ program that accepts somebody's name in any case then outputs it in the proper case
Create a C program that will generate a table of chosen mathematical operations. The user has to be prompted first for the math operation and then enter a value that will be used to add, subtract, multiply or divide from 1 to 10 to complete the table. A sample run is provided below to illustrate the output.
M A T H O P E R A T I O N S:
[M] – Multiplication
[D] – Division
[A] – Addition
[S] - Subtraction
Enter your choice: M
Enter your desired value to be multiplied: 10
1*10=10
2*10=20
3*10=30
4*10=40
5*10=50
6*10=60
7*10=70
8*10=80
9*10=90
10*10=100
Continue [Y/N]? Y
M A T H O P E R A T I O N S:
[M] – Multiplication
[D] – Division
[A] – Addition
[S] - Subtraction
Enter your choice: A
Enter your desired value to be added:5
1+5=6
2+5=7
3+5=8
4+5=9
5+5=10
6+5=11
7+5=12
8+5=13
9+5=14
10+5=15
Continue [Y/N]? N
Thank you for choosing my program