• Start of the body of the struct name Length.
• Create a struct member named meters of integer data type and centimeters of float data type.
• End of the body of the struct Length.
• Call the main () function.
• Create a pointer variable *ptr and normal variable l of type Length. Store the address of variable l in our pointer variable.
• Take user input of meter and centimeter through *ptr.
• Print the length in meters and in centimeters through using *ptr.
write a C++ program to Create a time class that includes integer member values for hours, minutes,and seconds.
Make a member function get_time() that gets a time value from the user, and a function
put_time() that displays a time in 12:59:59 format. Add error checking to the get_time()
function to minimize user mistakes. This function should request hours, minutes, and seconds
separately,
and check each one for ios error status flags and the correct range. Hours
should be between 0 and 23, and minutes and seconds between 0 and 59. Don’t input these
values as strings and then convert them; read them directly as integers. This implies that
you won’t be able to screen out entries with superfluous decimal points, as does the
ENGL_IO program in this chapter, but we’ll assume that’s not important.
In main(),use a loop to repeatedly get a time value from the user with get_time() and
then display it with put_time(), like this:
Enter hours: 11
Enter minutes: 59
Enter seconds: 59
time = 11:59:59
Do another (y/n)? y
Enter hours: 25
Hours must be between 0 and 23
Enter hours: 1
Enter minutes: 10
Enter seconds: five
Incorrect seconds input
Enter seconds: 5
time = 1:10:05
note: use OOP concepts
Write a C++ program to create a menu based calculator. Your program should perform the
following features:
+ , -, ×, ÷, log, Mod, √, 10x
, X3
, √?
?
, √?
?
, Xy
, X2
, Exp, sin, cos, tan, Inv (for sin, cos and tan).
Your program should be well thought and should not leave any possibility. For instance, it should not
only add two numbers t should add two or more numbers. Your program should first print a menu
displaying different options for user. Your program should look like as follows:
Calculator by your name
1. Addition (+)
2. Subtraction (-)
3. Multiplication (×)
4. Division (÷)
5. Log
6. Modular (Mod)
7. Square root (√)
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more
Recent Comments