Create a program that will do the following:
- Ask the user for a number from 1 to 20, check to ensure that a valid number is entered
- Ask the user for a second number from 1 to 20, check to ensure that a valid number is entered
- Ask the user for a third number from 1 to 20, check to ensure that a valid number is entered
- Display a message telling the user what is the largest number
- Display a message telling the user what is the second largest number
Write a program that follows the below rules: Scenario 1:Your friend is going to be another 15 minutes or more
Result: If you have more than 5 AED in change, go buy a coffee, otherwise go for a walk around the town
Scenario 2: Your friend is going to with you in less than 15 minutes
Result: Sit in the food zone and wait
You want to start a two-piece band, but first you need a friend to join it. If you have a musical friend, you next need to check (using a nested ifstatement) that they actually play an instrument you want in the band. You decide that they need to play either guitar or drums to join.
Write a program that checks to see if you can start a band! You should use the following variables to write your program:
bool musicalFriend = true; string friendPlays = "guitar";
Write a C++ program to create a class bank to deposit an amount,withdraw an amount,balance amount using multiple object.
Craete a class cylinder with radius and height as data member and perform the addition of two cylinders using constructor overloading.
PS using friend function
Create a class Cuboid1,Cuboid2 with below properties:
Display the cuboid 3 with the difference between cuboid1 and cuboid2 and print the volume of cuboid 3.Write a C++ program using friend function
#include <iostream>
Write a program for carpeting a rectangular room.
Create a class named Dimension that has three fields:
· one for the length of the room
· one for the width of the room
It also has a parameterized constructor to set the values of length and width with user-defined values and set area to zero.
Next create a class Carpet that is friend class of the Dimension class. It should have a field for the cost of the carpet per square foot and a parameterized constructor to set its value. The Carpet class should also have a method that calculates the area of the carpet (l*w) and then calculate the cost of carpeting the room by multiplying cost per sq foot with area. It will also return total cost of carpeting the room.
In main(), create instance of Dimension and set values. Then calculate and display total cost of carpeting the room through Carpet class object.
Explain in detail about the OOPs concepts in C++ with suitable examples
What is the purpose of constructors in c++.? How to denote the destructors in c++?
Give the order of execution of the constructors and destructors in a multilevel inheritance. Explain the same with a suitable program .