C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 8.5, Problem 3E

a.

Program Plan Intro

Program Plan:

  • Include library files for various operations.
  • Declare object ofofstream.
  • Create a statement to open the given file “polar.dat”.
  • Use if statement with fail() method to check that the entered file name is available or not.
  • Read data from the program and write data to the file.
  • int main() function is used to perform all the task.
  • Display the calculated results to the user.

Program Description: The main purpose of this program is to create the “polar.dat” file and tostore the given data in the file.

b.

Program Plan Intro

Program Plan:

  • Include library files for various operations.
  • Declare an object ofofstream.
  • Create a statement to open the given file “polar.dat”.
  • Use if statement with fail() method to check that the entered file name is available or not.
  • Display message to the user to enter the input.
  • Read data from the user and write data to the file.
  • int main() function is used to perform all the task.
  • Display the calculated results to the user.

Program Description: The main purpose of this program is to modify the program code given in part (a), so that the program can accept input from user and append the accepted data into the “polar.dat” file.

c.

Program Plan Intro

Program Plan:

  • Include library files for various operations.
  • Declare twoobjects forofstream and ifstream.
  • Create two open statementsfor “polar.dat” and “xycord.dat” file.
  • Use if statement with fail() method to check that the entered file name is available or not.
  • Use while loop to read the file.
  • Calculate x and y coordinate, by using the below given formula:

  x=r(cosθ)y=r(sinθ)

  • int main() function is used to perform all the task.
  • Close both the files.

Program Description: The main purpose of this program is to modify the program code given in part (a), so that the program can calculate x and y coordinate and store the calculated data in the “xycord.dat” file.

Blurred answer
Students have asked these similar questions
pattern recognitionPCA algor'thm
Consider the following program: LOAD AC, IMMEDIATE(30)                                                     ADD AC, REGISTER(R1)                                                     STORE AC, MEMORY(20) Given that the value of R1 is 50, determine the value stored at memory address 20 after the program is executed. Provide an explanation to support your answer.
Pattern RecognitonDecision Tree please write the steps not only last answer
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Literals in Java Programming; Author: Sudhakar Atchala;https://www.youtube.com/watch?v=PuEU4S4B7JQ;License: Standard YouTube License, CC-BY
Type of literals in Python | Python Tutorial -6; Author: Lovejot Bhardwaj;https://www.youtube.com/watch?v=bwer3E9hj8Q;License: Standard Youtube License