C++

C++ Programming: How to create a program in C++?

C++ Programming: How to create a program in C++?

C++ is a well known Computer Programming Language. Many Many and Many programs have already been written in C++ language. But for new mates, its difficult to learn C++ language without any reference. So if you are the one, don’t worry i am here to teach you with a simple and clean way.

C++ Programming Syntax:

Q: What is Syntax?

As you guys do lot of works every day. Every Work is done in its proper way. That proper way is known as syntax in C++ and in all other languages.

C++ Programming Steps:

Following Steps involves in Creating a C++ program.

  1. Writing the Code
  2. Compiling the Code
  3. Executing the Program.

Q: What is Program?

Every Software You Use on Your Computer is a program. A simple “Notepad“, “Calculator” and “Paint” etc.

All of these are programs. If you see a few messages in these programs such as

Notepad Dialogue Box

The message written in this Dialogue box

Do you want to save changes to Untitled?

was printed on this dialogue box by its programming language’s PRINT Function.

If this program is written in C++ Language then that line has been printed due to “cout” function of C++.

It is Pronounced as ‘See out’.

What You know now?

  1. Every thing which you see on screen is due to a “Print” function of language.
  2. You Know about Syntax. (Proper Format)

What You Don’t Know?

  1. Source Code
  2. Object Code

C++ Programming: Source Code

When you write a program, all of its code is known as source code. WHY?
Because its just a simple Code you have written in simple English.

C++ Programming: Object Code

Compiling:

The process of Conversion of Human’s written English Source Code into Computers Binary Language is called Compiling.

After Compiling, You can execute that file on your PC which is now known as Object file, and the code of that object file is known as Object Code.

IF YOU HAVE ALL THE ABOVE CONCEPTS CLEARED YOU CAN SEE THE FOLLOWING CODE.

Caution: Don’t read the following code if you haven’t cleared the above concepts. because this will put a burden on your brain. And you might fail to understand it.

// Code started.
#include<iostream>
using namespace std;
int main()
{
cout << "Hello World !" << endl;
return 0;
}
// Code Ended.

C++ programming: Code Explanation

  • The first line starting with “//” is a COMMENT.
  • Second line starting with “#include” is HEADER file.
  • Third line uses a namespace std, i.e cout, cin and many more are defined in standard ‘std‘.

NAMESPACE STD Will be defined later in detail.

  • Fourth line starts main function. main()
  • Fifth Line has a starting { bracket of main() function.
  • Sixth Line has a cout function
  • seventh line returns a value to main function which is 0 (ZERO)
  • Eight line ends } Bracket of Main function.
  • Ninth line “//” you already know that its COMMENT.

Program Working:

Comments Won’t Run in Program.

All the commands present  in { } of main() function executes one by one.

In the present Case:

  • cout function will run first.
  • Then return function.

Enough For Today.

Actually i am creating a full course of C++ and all other popular languages over here.

So Make sure you bookmark my site and Share it with others too.

If you won’t understand any thing feel free to comment.

For back-link lovers. If you want to get link in article make sure to add mine in yours and contact me in comment box to get yours.

ITS VIDEO WILL BE AVAILABLE SOON ON MY YOUTUBE CHANNEL

Make sure to

SUBSCRIBE

—–THEEND—–
Following sites contain some interesting info. you should check them out too.

About the author

deathdealer

Leave a Comment