Creating Console Application

7
 Creating C++ Console Application in Visual Studio 2005 By: Brad Rippe Fullerton College 1/12/2007 This work is licensed under the Creative Commons Attribution 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by /2.5/ or send a letter to C reative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.

Transcript of Creating Console Application

Page 1: Creating Console Application

8/3/2019 Creating Console Application

http://slidepdf.com/reader/full/creating-console-application 1/7

 

Creating C++ Console Application in Visual Studio 2005By: Brad Rippe

Fullerton College

1/12/2007

This work is licensed under the Creative Commons Attribution 2.5 License. To view a copy of this license,

visit http://creativecommons.org/licenses/by/2.5/ or send a letter to Creative Commons, 543 Howard

Street, 5th Floor, San Francisco, California, 94105, USA.

Page 2: Creating Console Application

8/3/2019 Creating Console Application

http://slidepdf.com/reader/full/creating-console-application 2/7

Introduction

This document explains how to create solutions, projects and C++ files in Visual Studio 2005. Solutions

encapsulate projects and handle how those enclosed projects are built and deployed. This allows related

projects to be setup under one solution. For simplicity, you can create one solution for one project or

one solution for all your projects. However, this document shows how to create one solution with one

project, but multiple projects can be added to the solution. The use of solutions and projects will

become more apparent as you get familiar with Visual Studio 2005.

Getting Started

To create a solution, start Visual Studio 2005. From the File menu, select File, New, and Project. A file

dialog will be displayed.

From the New Project dialog, select Visual C++ on the left-hand side (Project types), then select Win32

Console Application in the Templates. Type the name of the Project, choose a location (in the CS lab you

will want to select c:\cwork), type the name of your solution, and check the box labeled “Create

directory for solution”.

Page 3: Creating Console Application

8/3/2019 Creating Console Application

http://slidepdf.com/reader/full/creating-console-application 3/7

Next the Win32 Wizard will be displayed.

Click Next. The Application Settings dialog will appear.

Page 4: Creating Console Application

8/3/2019 Creating Console Application

http://slidepdf.com/reader/full/creating-console-application 4/7

 

Select Console application if it is not selected and check the Empty project checkbox. Then click the

Finish button. Visual Studio will create the solution and the project which can be viewed from the

Solution Explorer.

You will notice that the Solution “CoolCPlusPlus” was created in addition to the “CoolCPlusPlus” project.

Projects and solutions may have different names. You will also notice that are folders for Header Files (.h

files), resources, and source files (.cpp files). This is where your .h and .cpp files will be created.

Page 5: Creating Console Application

8/3/2019 Creating Console Application

http://slidepdf.com/reader/full/creating-console-application 5/7

Creating CPP Files

To create a .cpp (c++ source code file), right click on the Source Files folder. A popup dialog will appear,

select Add, New Item. A file dialog will appear.

From the Categories, select Code and from the Templates choose C++ File (.cpp). Next type the name of 

the new .cpp file, CoolCPlusPlus.cpp, and then click on the add button. This will add a new file to the

Source Files folder in the Solution Explorer and open the blank source file in Visual Studio’s text editor.

Page 6: Creating Console Application

8/3/2019 Creating Console Application

http://slidepdf.com/reader/full/creating-console-application 6/7

 

Once the CoolCPlusPlus.cpp file appears in the text editor you may type your source.

Page 7: Creating Console Application

8/3/2019 Creating Console Application

http://slidepdf.com/reader/full/creating-console-application 7/7

 

Make sure that your code is formatted and follows the provided style guide for the course. Once you

save the file you can compile the code and execute it if you have no compilation errors.