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
show work
show work on paper
show work on paper
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
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
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