BASICS FOR CREATING, COMPILING, EXECUTING, AND SAVING

advertisement
BASICS FOR CREATING, COMPILING, EXECUTING, AND SAVING C++ PROGRAMS
USING Visual C++ (Version 6.0)
1. Double click on the C++ icon
2. Click on NewTextFile button on the standard tool bar (it is the first icon on the second row)
Compile
Button
Build
Button
Run
Button
3. Key your program into the editor program.
4. Select FILE  SaveAs
- name your file
- Always add .cpp at the end of the program name (EXAMPLE: Lab5.cpp)
- Be sure you save your work in C:\Temp
- you won’t have room to build an executable program on your floppy disk
- click on okay
5. Click on the compile button on the toolbar (see illustration)
When asked if you’d like to create an active workspace, click on “yes”
Correct all errors listed at the bottom of your screen – and compile again
6. Click on the build button on the toolbar (see illustration). After the first run of your program skip the build choice but you must compile
everytime that you make a change in code.
7. Click on the run button on the toolbar; it looks like an exclamation point and turns red when applicable(see illustration)
When your program is completed, exit Visual C++ and open Windows Explorer.
Your file was saved in C:\ temp – if you followed directions in step 4 above
Your source code will be saved in a file with the .cpp extension. This is the file you want to copy to your disk and to the homework
subdirectory.
8. To save your program onto YOUR DISK, go to the C:\temp subdirectory and COPY your source file (remember, it ends with .cpp) onto your
disk (A: drive).
You are to only save the source code (file that ends in .cpp onto your disk; do not save the object code.
How to copy to your disk: CLOSE AND EXIT YOUR C++ PROGRAM – OPEN WINDOWS EXPLORER
a. Single click on your .cpp file in the C: \temp subdirectory
b. Select EDIT (from the menu bar) and copy
c. Select "3½ Floppy (A:)"
d. Select EDIT and paste
9. To copy your program into my subdirectory for grading purposes, use the same instructions found in step 8 above, EXCEPT select
F:\user\Alam\Assignments-turn\CS230.
**** DO NOT TRY TO SAVE YOUR HOMEWORK INTO THE CS230 SUBDIRECTORY BY USING THE SAVEAS COMMAND
INSIDE OF Object C++. YOU WILL END UP WITH AN EMPTY FILE IN THE SUBDIRECTORY!! To make sure your file has your
saved program in it, click on the Details button on the Explorer button bar; it’s the far right button. Explorer will tell you how many bytes
are in your file. If 0 (zero) bytes are displayed next to your file, you need to copy your homework again.
ALWAYS CHECK to make sure your homework files are not empty in the homework subdirectory!!!
Double check to make sure you have your .cpp file on your disk BEFORE continuing to step 10.
10. To prevent other students from getting copies of your work, DELETE all your files from
C:\ TEMP
11. Dump all documents from the Recycle Bin:
a. Exit Explorer
b. Place your cursor arrow on the Recycle Bin icon
c. Click the RIGHT mouse button
d. Select "DELETE ALL" from the pull-down menu.
Download