Skip to main content
留学咨询

C++ Homework

By May 15, 2020No Comments

Homework 2100 Points2D Arrays22B_H_2A.cpp (find and fix errors: print a table) 22B_H_2B.cpp (find and fix errors: quiz average) 22B_H_2C.cpp Project: Triangle (see next page)GradingProgram 2A 15Program 2B 20Program 2C1.main()– 52.The readTriangle function– 153.The printTriangle function– 104.Find path– 155.Print path– 156.Self Assessment Report– 5Self Assessment Report: Write a short report, ( see 22B_H_2Report.doc form) briefly explaining your code and containing an assesment of your implementation based on the above grading criteria.Run each programonce and save the output at the end of the source file as a comment. Compress the source files, input and output files (if any), and the report, and upload the compressed file: 22B_LastName_FirstName_H2.zipNext PageProject: Triangle(Figure 1)73 88 1 02 7 4 44 5 2 6 5Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top and ends somewhere on the base. Each step can go either diagonally down to the left or diagonally down to the right. The number of rows in the triangle is >1 but <=100. The numbers in the triangle, all integers, are between 0 and 99.Input Data: Data about the number of rows in the triangle are first read from the input file. In our example, the input file appears as follows:5 // This triangle has 5 rows73 88 1 02 7 4 44 5 2 6 5Output DataDisplay the triangle if and only if its size is <= 15, as shown below:Triangle size = 573 88 1 02 7 4 44 5 2 6 5Display the highest sum (30 in our example) and the path (row, column andvalue) as shown below.( 0, 0) - 7( 1, 0) - 3( 2, 0) - 8( 3, 1) - 7( 4, 1) - 5=== 30(Optional) In addition to the above output, if the number of rows <= 15 display the path a second time as shown below.|7||3 _||8 _ _||_ 7_ _||_ 5_ _ _|Highest sum = 30.Algorithm – will be discussed in class.

admin

Author admin

More posts by admin