Академический Документы
Профессиональный Документы
Культура Документы
Section:
(Circle one)
10:00
Run the project in the normal manner and you will see the result below.
4002-208
Page 1 of 8
Fall 2012
Lab 9
4002-208
Page 2 of 8
Fall 2012
Lab 9 2. After you can successfully run the default project, download the file 208_Lab9.7z from the Lab 9 module in myCourses. When you unzip the file, you will find the four files below. You will use only the first three in the remainder of Exercise 1. File testMyInput.cpp myInput.cpp myInput.h readIntPos.cpp Description Contains the main function to test the code in the input function in myInput.cpp. Contains the code for the input function readInt. Contains the prototype for the input function readInt Used later
3. Copy the first three files above into your project folder. Your instructor used the folder named myInput which contains two folders bin and obj after the project was executed. 4. Now, remove the file main.cpp from the project and add the first three above to the project. To remove a file, use Project Remove file. To add the three files, use Project Add files. The Management pane should appear as below after the deletions and additions.
The file testMyInput.cpp did not include the prototype for the function readInt. This prototype is in the file myInput.h. You need to include this file
4002-208
Page 3 of 8
Fall 2012
Lab 9 in the file testMyInput.cpp. Use the following include statement: #include "myInput.h" The file is enclosed in double quotes as it is a local include file. The symbols <..> surrounding a file name indicate a system include file. Code::Blocks knows the location of the system include files. Execute the project. See sample execution on the next page.
4002-208
Page 4 of 8
Fall 2012
Signature: _________________________ Date: __________________________ Have your instructor or TA sign here when Exercise 1 works correctly.
4002-208
Page 5 of 8
Fall 2012
Lab 9
Signature: _________________________ Date: __________________________ Have your instructor or TA sign here when Exercise 2 works correctly.
4002-208
Page 6 of 8
Fall 2012
Lab 9
13. Add code to call the new function from the main function as shown in the sample output on the next page.
4002-208
Page 7 of 8
Fall 2012
Signature: _________________________ Date: __________________________ Have your instructor or TA sign here when Exercise 3 works correctly.
4002-208
Page 8 of 8
Fall 2012