.

Saturday, February 23, 2019

Programm

Programming exercises 1. Consider the followers incomplete C++ course of instruction accept int main() . a. Write a tale that include the header files fstream, string, and iomanip in this political program. b. Write statements that declare inFile to be an ifstream variable and outFile to be an ofstream variable. c. The program will read data from the file inData. txt and create verbally output to the file outData. txt. Write statements to open both of these files, cerebrate inFile with inData. txt, and associate outFile with outData. txt. . Suppose that the file inData. txt contains the following data 10. 20 5. 35 15. 6 randy Gill 31 18500 3. 5 A The numbers in the send-off line represent the length and width, respectively, of a rectangle. The number in the succor line represents the radius of a circle. The third line contains the first name, last name, and the age of a person. The first number in the stern line is the savings account balance at the beginning of the mon th, and the second number is the interest rate per year. (Assume thatp = 3. 1416. The fifth line contains an uppercase garner between A and Y (inclusive). Write statements so that afterward the program executes, the contents of the file outData. txt are as shown below. If necessary, declare additional variables. Your statements should be general enough so that if the content of the gossip file changes and the program is run again(without editing and recompiling), it outputs the appropriate results. Rectangle Length = 10. 20, width = 5. 35, area = 54. 57, contestation = 31. 10 Circle Radius = 15. 60, area = 764. 4, circumference = 98. 02 Name Randy Gill, age 31 Beginning balance = $18500. 00, interest rate = 3. 50 Balance at the end of the month = $18553. 96 The character that comes after A in the ASCII set is B e. Write statements that close the input and output files. f. Write a C++ program that tests the statements in move a through e. 4. During each summer, John and Jessica grow vegetables in their bear out yard and buy seeds and fertilizer from a local nursery. The nursery carries variant types of vegetable fertilizers in various bag sizes.When buying a peculiar(a) fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per hearty foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of bag, and the area in square feet, that can be cover by the bag. The program should output the desired result. However, the program contains logical errors. remark and correct the logic errors so that the program works properly. // Logic Errors include include iomanip using namespace std int main() double cost double area triple bagSize cout

No comments:

Post a Comment