Go to
http://www.microsoft.com/express/vc/
>> Download Now!
Web Install
Microsoft Visual C++ 2010 Express Edition
English >> Download
You have chosen to open
vcsetup.exe
You must restart your computer to complete the installation.
File →
New →
Project…
In the
New Project
window,
the left pane lists the project types
and the right pane lists the available templates for that type.
Project types:
General
Template:
Empty Project
Name:
prog
In the
Empty Project Wizard
window,
press
Finish.
Project →
Add New Item… →
C++ File (.cpp)
Name:
main.cpp
Press
Add.
Now type in the file, stating with
#include <iostream>.
Don’t forget the
system("PAUSE");.
File →
Save main.cpp
Debug →
Build Solution
Debug →
Start Without Debugging (or control-F5)
Press any key to continue…
You can also run your executable from the Windows Command Prompt. Insert the statement
system("PAUSE");
immediately before every
return
from the
main
function
and immediately before every call to the functions
exit
or
abort.
Rebuild the executable.
Then at the Windows Command Prompt (cmd.exe),
go to the directory that holds the executable:
cd C:\Users\myname\My Documents\Visual Studio 2010\Projects\prog\Debug dir prog.exe echo %errorlevel%
Project →
projname Properties… →
Configuration Properties →
C/C++ →
Language →
Disable Language Extensions →
Yes (/Za)
Press
Apply
and
OK.
A helpful student provided the following instructions.
stdafx.h.)
term.h
in the header section and
term.c
and
main.cpp
in
the source section.
VC++ lists no code template for a C file,
but if you choose the C++ file template and name the file with a
.c
extension,
VC++ happily accepts it and does the right thing as explained below.
term.c
to bring up its properties dialog and traverse the list:
.c
extension.
You can test that by renaming the
file to
term.cpp;
observer that the “Compile As” option changed to
“C++ Code”.
You could also change it manually.