expand icon
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

النسخة 8الرقم المعياري الدولي: 978-1285867410
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

النسخة 8الرقم المعياري الدولي: 978-1285867410
تمرين 1
Exercise: Understanding the C++ Compiler
In this exercise, assume you have written a C++ program and stored your source code in a file named MyCPlusPlusProgram.cpp. Answer the following questions:
What command would you use to compile the source code?
التوضيح
موثّق
like image
like image
Compiling C++ program:
Compiler is a program, which covert source code of a program into executable code in following two steps:
• First, object code is generates from source code with the same file name but with the extension ".obj".
o The extension of source code of C++ program is ".cpp".
• Then, the object code is linked with executable code and the file is created with same file name but with the extension ".obj".
• Name of the visual C++ compiler is "cl" and it both a compiler and linker.
The following is the command to compile the C++ program in visual C++:
cl program_name.cpp
Here,
• "cl" represents the compiler
• "program_name.cpp" represents the file name
Note: Execute the program in the Developer command prompt for VS2012 and change the file path to the path, where source code file resides.
The command use to compile source code "MyCPlusPlusProgram.cpp":
cl MyCPlusPlusProgram.cpp
Here,
• "cl" represents the compiler
• "MyCPlusPlusProgram.cpp" represents the file name
close menu
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
cross icon