
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 13, Problem 13.15E
Program Plan Intro
Program Plan:
- Make a header file Point.h
- Declare header definition- include necessary header files and then create point class declaration.
- Make stream insertion and stream extraction overloaded function as friend to the class.
- Declare two private integers to store number point as xCoordinate and YCoordinate.
- End point header.
- Create “Point.cpp” file for defining function of header “Point.h”.
- Include all necessary header file and also "point.h" for making point class declared in header file available here.
- Overload the stream insertion operator, to display xCoordinate and YCoordinate.
- Overload the stream extraction operator, to check if input is in form "(x,y)” or not.
- Declare array p to get input from stream, extractx and extracy to extract value of xCoordinate and YCoordinate from the stream.
- Determine the size of stream "p".
- Set initial value of fail to 1.
- Check if first and last character of input is '(' and ')' respectively, if not se fail to 1.
- In the else part. run two loops to get x and y value of point which is seperated by ','.
- Run for loop from position 1 till ',' is found or till counter 'i' reaches size of input 'p'. Which means no ',' is entered, thus wrong input.
- Check if character is digit or not, if not a digit, then set fail=1, else extrcat value in extractx.
- After execution of for loop, check if “fail ==1 (some incorrect input) or i != size (which means no comma found)”. If both cases are false, then use a similar for loop to extract value of y.
- Check if “fail==1” (some wrong input) and set ios::failbit and clear the input.
- If fail is still 0, then put values of extractx and extact y in xCoordinate and YCoordinate respectively.
- Return the input.
- Make "Main.cpp" to write main function, which must include "point.h"
- Declare "p" as object of point class.
- Use cin>>p which itself will call overloaded extraction and check for input.
- Check the rdstate for goodbit, if failbit not set then display point using cout<<p. which will again call insertion overload for display.
- Else error message is displayed.
- Return and exit.
Program Description:
Write a point class, which checks for valid input data by overloading stream insertion and stream extraction operator functions.
Expert Solution & Answer

Want to see the full answer?
Check out a sample textbook solution
Students have asked these similar questions
Find the voltage V0 across the 4K resistor using the mesh method or nodal analysis. Note: I have already simulated it and the value it should give is -1.714V
Resolver por superposicion
Describe three (3) Multiplexing techniques common for fiber optic links
Chapter 13 Solutions
C++ How to Program (10th Edition)
Ch. 13 - (Write C ++ statements) Write a statement for each...Ch. 13 - (Inputting Decimal, Octal and Hexadecimal Values)...Ch. 13 - Prob. 13.8ECh. 13 - (Printing with field Widths) Write a program to...Ch. 13 - (Rounding) Write a program that prints the value...Ch. 13 - (Length of a String) Write a program that inputs a...Ch. 13 - (Converting Fahrenheit to Celsius) Write a program...Ch. 13 - In some programming language, string are entered...Ch. 13 - Prob. 13.14ECh. 13 - Prob. 13.15E
Knowledge Booster
Similar questions
- Could you help me to know features of the following concepts: - commercial CA - memory integrity - WMI filterarrow_forwardBriefly describe the issues involved in using ATM technology in Local Area Networksarrow_forwardFor this question you will perform two levels of quicksort on an array containing these numbers: 59 41 61 73 43 57 50 13 96 88 42 77 27 95 32 89 In the first blank, enter the array contents after the top level partition. In the second blank, enter the array contents after one more partition of the left-hand subarray resulting from the first partition. In the third blank, enter the array contents after one more partition of the right-hand subarray resulting from the first partition. Print the numbers with a single space between them. Use the algorithm we covered in class, in which the first element of the subarray is the partition value. Question 1 options: Blank # 1 Blank # 2 Blank # 3arrow_forward
- 1. Transform the E-R diagram into a set of relations. Country_of Agent ID Agent H Holds Is_Reponsible_for Consignment Number $ Value May Contain Consignment Transports Container Destination Ф R Goes Off Container Number Size Vessel Voyage Registry Vessel ID Voyage_ID Tonnagearrow_forwardI want to solve 13.2 using matlab please helparrow_forwarda) Show a possible trace of the OSPF algorithm for computing the routing table in Router 2 forthis network.b) Show the messages used by RIP to compute routing tables.arrow_forward
- using r language to answer question 4 Question 4: Obtain a 95% standard normal bootstrap confidence interval, a 95% basic bootstrap confidence interval, and a percentile confidence interval for the ρb12 in Question 3.arrow_forwardusing r language to answer question 4. Question 4: Obtain a 95% standard normal bootstrap confidence interval, a 95% basic bootstrap confidence interval, and a percentile confidence interval for the ρb12 in Question 3.arrow_forwardusing r languagearrow_forward
- using r languagearrow_forwardusing r language Obtain a bootstrap t confidence interval estimate for the correlation statistic in Example 8.2 (law data in bootstrap).arrow_forwardusing r language Compute a jackknife estimate of the bias and the standard error of the correlation statistic in Example 8.2.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,

C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr

Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning

Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,