I want to write simple C++ code for adding two integers (in a command line window). How do I do this in Visual Studio 2010?
(I know the code for adding the numbers.. I don’t know how to prepare the files)
@Armen Tsirunyan
I did just that, then I added the following code to the c++ file:-
#include <iostream.h>
main()
{
int integer1, integer2, sum;
cout << "Please enter first number";
cin >> integer1;
cout << "Please enter second number";
cin >> integer2;
sum = integer1 + integer2;
cout << "The sum of the two numbers is: " << sum << endl;
return 0;
}
but I got a message telling me that the project was out of date and I would like to build it, I put “yes”… then I got an error!
Open Visual Studio
File -> New Project
Select Visual C++ -> Win32 -> Win32 Console Application
Enter name and location press OK
Select Application Settings. Remove the check from Precompiled headers. Add the check for empty project. Click Finish
Click Project -> Add New Item -> C++ file
Code and enjoy 🙂