Introduction:
Here I will explain how to write and run c or c++ program in visual studio 2010 / 2012 / 2013 or execute c / c++ programs in visual studio 2010 / 2012 / 2013 or how to use visual studio to run c / c++ programs with example.
Description:
In previous articles I explained visual studio keyboard shortcut keys, zoom in / zoom out options in visual studio to increase font size, visual studio tfs key is not valid for use in specified state, asp.net mvc project template types in visual studio and many articles relating to visual studio, asp.net, c#, vb.net, JavaScript and jQuery. Now I will explain how to write and execute c / c++ programs in visual studio 2010 / 2012 / 2013 with example.
In previous articles I explained visual studio keyboard shortcut keys, zoom in / zoom out options in visual studio to increase font size, visual studio tfs key is not valid for use in specified state, asp.net mvc project template types in visual studio and many articles relating to visual studio, asp.net, c#, vb.net, JavaScript and jQuery. Now I will explain how to write and execute c / c++ programs in visual studio 2010 / 2012 / 2013 with example.
To
write and run c / c++ programs in visual studio you need to follow below steps.
First
open visual studio Go to File --> New --> Project like as shown below
Once
we click on Project new window will open in that Go to Visual C++ Project Templates in left side and if you found Win32 section that would be fine
otherwise go to Extensibility -->
select Install visual studio extensibility for Visual C++ and Click OK to
install C++ extensions in visual studio like as shown below
Once
we click OK button it will install Visual C++ extension in our visual studio.
Now reopen visual studio you will find Win32
option in Visual C++. Now select
Win32 Console Application --> Give name to Application and click OK like as
shown below.
Once
we click OK button it will show Win32 Application wizard in that click Next to
continue like as shown below
In
next step make sure Console Application selected and select Empty project and
click Finish like as shown below
Now
right click on your project Select Add --> New Item like as shown below
Now
a new dialog will open in that select C++
File and give name to that file. Here we will see file name with .cpp extension we need to change that
extension to .c and click OK like as shown below
Now
open file and write the code like as shown below
#include<stdio.h>
#include<conio.h>
void main()
{
printf("Running
C from Visual Studio");
getch();
}
|
In
case if you are getting any error for “getch()”
please change that one to “_getch()”.
Now we will run the program for that just click F5 button or build the
application directly from visual studio. We will get output like as shown below
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
0 comments :
Note: Only a member of this blog may post a comment.