Professional Documents
Culture Documents
Problem
A program that will display a simple welcome message.
Program
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello! We are Group 5!"<<endl;
return 0;
}
Output
Discussions
In creating a new program, you need to create a project and add a source file:
1. Create a project by pointing to New on the File menu, and then
clicking Project.
2. In the Visual C++ project types pane, click Win32, and then click Win32
Console Application.
3. Type a name for the project.
By default, the solution that contains the project has the same name as the project,
but you can type a different name. You can also type a different location for the
project.
Click OK to create the project.
4. In the Win32 Application Wizard, click Next, select Empty Project,and then
click Finish.
5. If Solution Explorer is not displayed, on the View menu, click Solution
Explorer.
6. Add a new source file to the project, as follows.
a. In Solution Explorer, right-click the Source Files folder, point to Add,
and then click New Item.
b. In the Code node, click C++ File (.cpp), type a name for the file, and
then click Add.
#include <iostream>
Means we include a certain library called iostream.
using namespace std;
Use as a support for the library and serves as a category or shelf.
The std means standard.
The semicolon (;) is used as a terminator.
int main ()
Means you are tagging main program.
The int means integer.
The main is a function coupled with the return 0 value at the end of the main
program.
What is inside in the { } it is called the main program.
The double quotation ( ) connotes the message that will be displayed.
Reserved words:
cout<<
used as an output or we are to display a message
cin>>
used as an input or you need to enter something
<<endl;
if there are two succeeding output to be programmed you need to put
(<<endl;) to separate first line and second line.
(cout<<endl;) means skipping the next line.
return 0;
means nothing is to be return
it is applicable only if you start with your body with int main()
Note:
The Visual Studio is case, symbol and space sensitive.
All lines in the main program has semicolon(;) as ending which serves as a terminator.
Variables entered should be:
DESCRIPTIVE
-variable names should be easily identified when a programmer debugs the
program.
CONSISTENT
FOLLOW RULES:
No spacing
No numbers at the beginning
No symbols at the beginning
Source: https://msdn.microsoft.com/en-us/library/ms235629.aspx
Programming with C++ by B.L. Juneja and Anitha Seth