Define the stream extraction operator functions

Assignment Help Programming Languages
Reference no: EM132161001

Assignment -

1. Write C++ statements: write a statement for each of the following:

a. Print integer 40000 left justified in a 15-digit field.

b. Read a string into character array variable state.

c. Print 200 with and without a sign.

d. Print the decimal value 100 in hexadecimal form preceded by 0x.

e. Read characters into array charArray until the character 'p' is encountered, up to a limit of 10 characters (including the terminating null character). Extract the delimiter 'p' from the input stream, and discard it.

f. Print 1.234 in a 9-digit field with preceding zeros.

2. Write a program that converts integer Fahrenheit temperatures from 0 to 212 degrees to floating-point Celsius temperatures with 3 digits of precision. Use the formula celsius = 5.0 / 9.0 * (fahrenheit - 32);

3. Write a program that accomplishes each of the following:

a. Create a user-defined class Point that contains the private integer data members x-Coordinate and y-Coordinate and declares stream insertion (<<) and stream extraction (>>) over-loaded operator functions as friends of the class.

b. Define the stream insertion and stream extraction operator functions. The stream extraction operator function should determine whether the data entered is valid, and, if not, it should set the failbit to indicate improper input.

input.setstate(std::ios::failbit);

The stream insertion operator should not be able to display the point after an input error occurred.

c. Write a main function that tests input and output of user-defined class Point, using the overloaded stream extraction and stream insertion operators.

d. See Fig 10.3 to Fig 10.5 for examples, page 456-457 of the C++ book.

Reference no: EM132161001

Questions Cloud

How you would approach a health education program : Explain how you would approach a health education program for African Americans and Diabetes. Support your choices with scholarly references.
Determine what the maturity date should be : A 9%, $10,000 bond that has interest payable semiannually sells for $8500. Determine what the maturity date should be so that the purchaser may enjoy a 12%.
Finding the coupon interest rate : At what coupon interest rate will a $20,000 bond yield a nominal 12% interest compounded quarterly if the purchaser pays $18,000 and the bond becomes.
Which healthcare model is better and why : Compare and contrast the range of medical language interpretation and describe what is considered "best practice."
Define the stream extraction operator functions : CS3528 Assignment - Define the stream insertion and stream extraction operator functions. Write a main function that tests input of of user-defined class Point
What symbols do you see on the foods that are irradiated : What symbols do you see on the foods that are irradiated? What are the requirements for labeling?
What nominal and effective rate of return per year were made : An investor purchased a 5%, $5000 bond for $4000. The interest was payable quarterly, and the bond's maturity was 20 years. The bond was kept for only 9 years.
What are some of the major areas that are covered : What are some of the major areas that are covered? Why are these important to the profession?
Find nominal and effective rates of return per year : A 12%, $50,000 bond is offered for sale at $45,000. If the bond interest is payable monthly and the bond matures in 20 years, what nominal and effective rates.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write the program by declaring one-dimensional array

Write the program by declaring one-dimensional array which could be used to hold data for grades (int type) of 10 students. The program will prompt user for numeric grades.

  Write a full program that asks the user to input six value

Write a full program that asks the user to input six value that represents the x and y coordinates for three points (x1, y1), (x2, y2), (x3, y3).

  Write a program that display amount of discount on item

Write a program that asks the user to enter number of packages purchased. Program must then display amount of the discount (if any) and total amount of the purchase after the discount.

  Write statement to call calculate interest method

Write the statement(s) necessary to call the calculate interest method with an account balance of $2300.00 and an interest rate of 5%.

  Report on simple ms office operations include screen shot

Report on simple MS office operations include screen shot. Use your own choice of fonts and sizes. Set a top margin of 3 cm and bottom left and right 2 cm.

  Formula translation

Write a c code that will evaluate the roots of a quadratic equation

  Write program which translate letter grade into number grade

Write program which translates a letter grade into number grade. Letter grades are A, B, C, D, F, possibly followed by + or -.

  Create logic for program-continously prompts for numeric

Create the logic for a program that continously prompts the user for two numeric values that represent the sides of a rectangle.

  Explain the theory & concepts involved in the design of page

Discuss what makes an effective as well as a poorly designed web page, and be able to critically evaluate them

  Hru access control matrix model

How will the matrix above result if we execute the command and Write a command delete_object(sub1,sub1) that will delete any occurrences of sub1 if sub1has the right m with itself

  Write spark program that load data and analyze data quality

Write a Spark program that loads the data, analyzes data quality, provides a summary report, and reports your findings, abc is an eCommerce company

  Write down a program which reads an integer between 0 and

write a program that reads an integer between 0 and 10000 by selecting the integer at random then sum the digits. for

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd