Write C++ program to print pyramid using *.
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
write a c++ program that creates a one dimentional array with of length 5. Your program should read 5 integers from the keyboard into the array. You are to perform sequential search for an integer in the array and push the location of the element sought for on to a stack.
Imagine a publishing company that markets both book and audiocassette versions of its works. Create a class publication that stores the title (a string) and price (type float) of a publication. From this class derive two classes: book, which adds a page count (type int), and tape, which adds a playing time in minutes (type float). Each of these three classes should have a getdata() function to get its data from the user at the keyboard, and a putdata() function to display its data. Write a main() program to test the book and tape classes by creating instances of them, asking the user to fill in data with getdata(), and then displaying the data with putdata().
Create a class called 'TIME' that has
- three integer data members for hours, minutes and seconds
- constructor to initialize the object to zero
- constructor to initialize the object to some constant value
- member function to add two TIME objects
- member function to display time in HH: MM: SS format
Write a main function to create two TIME objects, add them and display the result in HH: MM: SS format.
Define a class for a Bank account that includes the following data members: Name of the depositor, Account number, Type of account, Balance amount in the account.
The class also contains following member functions:
A constructor to assign initial values.
Deposit function to deposit some amount. It should accept amount as parameter.
Withdraw function to withdraw an amount after checking the balance. It should accept the amount as parameter.
Display function to display name and balance.
Create a class Car that contains following attributes: The name of car, the direction of car(E,W,N,S) and the position of car(from imaginary zero point)
The class has following member functions: A constructor to initialise the attributes, Turn function to change direction of the car to one step right side. Overload the turn function to change the direction to any side directly. It should accept the direction as parameter.
More function to change the position of car away from zero point. It should accept the distance as parameter.
Write a program to compute the volume of a cylinder.your program reads the redius and length and computes using the formula
Area =radius *radius *pi
Volume =area =*length.