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 a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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