Вы находитесь на странице: 1из 2

Dev-C++ Tutorial

This lab activity is to demonstrate the basic steps involved in coding, compiling, executing, and testing a program in the Dev-C++ Integrated Development Environment (v4.9.9.2). You can obtain and install his software (Dev-C++ 5.0 beta 9.2 (4.9.9.2) (9.0 MB) with Mingw/GCC 3.4.2) on you home computer by following the instruction from his official website: http://www.bloodshed.net/dev/devcpp.html. Run setup program, accept all default options. Follow the directions below in the order indicated: 1. Start Dev-C++ from the start menu. 2. From the "File" menu, choose "New Source File" (or click on the "Source file" button, the third from the left on the button bar (just under the menu bar). An insert cursor (vertical blinking line) will appear in the edit window. 3. Type the following line. Use the backspace key as necessary to correct typos: /* lab1_Name.c -- Your Name */ 4. Save your program as follows: a. From the File menu, choose "Save as ..." b. In the "Save File" dialog box that opens, navigate to the directory where you want to save your source file. c. In the "File name" text box, change the file name to: lab1_name.c d. Click on the Save button to save the file. 5. When you return to Dev-C++, the name of your file should appear in the tab above the text window. Now enter the rest of the program. Use the cursor arrow keys or mouse and the backspace or delete keys to correct your typos. 6. When you have finished entering the program, save it by clicking on the diskette icon (the fourth one from the left) on the button bar (or File >> Save). 7. Compile your program: From the "Execute" menu, choose "Compile". 8. If you typed the above program perfectly, the Compile Progress status window will display the status "Done", with 0 errors and 0 warnings. If this is not the case, you have syntax errors (typos) in your program that need to be fixed before it can be run. To do this: a. Scroll in the bottom window to display the first syntax error. b. Double-click anywhere in the line that explains the error. In the Edit window, an indicator will show you in which line of your program the compiler thinks your syntax error occurred.

c. Read the explanation of the error and compare your typed line with the program listing above. The error may in this line or a line that comes before it. Identify and correct the error. 9. Repeat steps 6-8 until you have corrected all your syntax errors. 10. Run your program: Close the Compile Progress window, and from the Execute menu chose "Run" (or click on the second icon from the left on the second button bar). 11. A console window will appear and your program will be running. Your program will accept data, and compute and display the result and the message "Press any key to continue." When you do, the console window will close and you will return to Dev-C++. If you want to execute your program again, from the "Execute" menu, choose "Run". This program should work fine, but usually you will find logic errors in it that will need to be corrected by repeated analysis, editing, compiling, and testing. 12. When you are finished, exit Dev-C++ from the File menu.

Вам также может понравиться