Starting from:

$10

CS2028-Lab 1 IDE, Debugging, Arrays and Structs Solved

The objective of this homework is to get familiar with the editing and compilation environment, modify a simple C++ program, design a Struct and implement it in a C++ program, prepare a well documented report and submit to the lab instructor.

Task 1:  Familiarize yourself with the IDE.

1.     Download and install the IDE of your choice.  In case you have not chosen any IDE yet, try downloading Visual Studio.  The community edition is located at

https://www.visualstudio.com/downloads/.  Make sure you include the C++ language during the setup.

2.     Create a new project.  You can name this whatever you like (but a descriptive naming is recommended).

3.     Try to use the code from Gaddis program 8-6 as our first example. You may find that the source code of the text can be found and be downloaded from http://wps.pearsoned.com/ecs_gaddis_sowcpp_cs_8/244/62625/16032053.cw/index.html.

4.     Create a breakpoint on line 41 and step through the code until you have displayed two rows of products on the screen.

5.     Take a screen shot of the output screen and the IDE to include in your lab report. Task 2:  Debugging.

1.     Create a new project.

2.     Copy the provided code from the file Lab1-Task2.cpp into your project.

3.     Compile and run the code.

4.     Your user has noted the following errors.  Fix them.

a.      The division in the output is incorrect

b.     The amounts in the division are incorrect.  One of the values is a really large negative number that looks like garbage.

c.      The total is 0 but it shouldn’t be.


Task 3:  Structures. 

0.     Browse Chapter 11(Sections 1 through 5) of Gaddis’ text on structured data.

1.     Reuse the project from task 1.

2.     Create a structure to replace the 4 arrays in the program (id, units, prices, sales).

3.     Modify the code in the main function to have a single products array of type defined in step 2.

4.     Modify the code in the rest of the program to use the single products array rather than the 4 original arrays.

More products