Sams Teach Yourself C in 21 Days

(singke) #1
To enter and compile the Sample.c program in Listing G.1, follow these steps:
1.Create a new source file.
With Dev-C++ open, select “New Source file” from the File menu option. Dev-
C++ will automatically create a source file and place some code into it. Figure G.7
shows this dialog with the default code.

888 Appendix G

FIGUREG.7
The default source file.

2.Enter the source file.
As shown in Figure G.8, replace the code in the dialog with the code from Listing
G.1 above. You will enter listings from this book in the same manner. You should
note that line 6 of this listing prints out a simple message. Line 8 is added to cause
the program to pause until you press a key. Without this line, when you execute the
program you would not see the results because they would be displayed and
removed too fast. More will be said on this later.
3.Save the source file.
Once you have entered the source code, you need to save it. Dev-C++ gives the file
a default name of Untitled followed by a number. To save your program and give it
a more useful name, select “Save unit as” from the File menu. You will be
prompted with a standard save dialog as shown in Figure G.9.

50 448201x-APP G 8/13/02 11:22 AM Page 888

Free download pdf