INTRODUCTION TO C++

0 comments
MOST BASIC PROGRAM FOR C++


Introduction to C++ 


First of all we’ll understand what a C++ language is. In this post I’ll cover Introduction to the C++ language followed by the COMPILER used to compile & run C++ coding and then finally a basic C++ program to print a sentence. C++ is a programming language; it will allow you to control your Computer, making it do what you want to do. This blog label named C++ Programming is planned for everyone (even if you’ve never programmed before). These programming tutorials will help you to take advantage of C++.


GETTING C++ COMPILER:

The very basic need before starting out in C++ is to have a compiler. Now you’ll ask what the heck compiler is, hey... Hey... Wait it’s not a heck it’s what we need mainly. A compiler turns the program that you write into an executable that your computer can actually understand and run. If you are enchanting a course, you most likely have one provided through you institute. If you are starting on your own, then you need a compiler, and the best compilers are-

1.     Turbo C++ [For Windows]

2.     G++ [For Linux]

3.     Xcode [For Mac OS X]


INTRODUCTION TO THE C++ LANGUAGE:

A C++ program is a collection of commands, which tell the computer to do a task. These collections of commands are termed as C++ source code.

COMMANDS:-        

  1. FUNCTIONS                        
  2. KEYWORDS

Keywords are a basic building block of the language while using Functions we can structure our programs in a more modular ways, accessing all the potential that structured programming can offer to us in C++. Every program in C++ has one function, always named main, is called when our program first executes. From main you can also call other functions. One is written by us or the other is prewritten functions, which are provided by the compiler. To access those prewritten functions, you include header with the #include directive.


LET’S LOOK AT A PROGRAM:

#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
cout<<”Hello World”;
getch();
}


Turbo C++ View [For Windows] 




Press Alt + F9 - Check for errors
&
Ctrl + F9 - Compile

OUTPUT: 



ELEMENTS OF PROGRAM:
Let’s look at the elements of the program-·       

The #include is a preprocessor directive that tells the compiler to put code from the header called “iostream” into our program before creating the executable. By including header files, you gain access to many different functions.·       By adding the header file “iostream”, we can use the functions such as cout.       

The semicolon (;) is part of the syntax of C++. It tells the compiler that it is end of a command.

The line int main() tells the compiler that there is a function named main, and that function returns an integer, hence int. This function have beginning and ending denoted by { and } sign.·       

Next is the clrscr(); which is used to clear the screen every time the program is being executed to make the cleanliness of output.

cout object is used to display text. It uses the << symbols, known as “insertion operators”, to specify what to output.·       

Next command is getch(); which reads in input and expects the user to hit the return key. Many compilers will open a new console window, run the program, and then close the window. This command prevents the window from closing because the program is not yet completed.

This is all you can grasp from this introductory post on C++. Hope you’ve learned a lot and in detail. Kindly appreciate our work by placing your valuable comment. Have peace..!!


Abhishek Kr.
About the Author:
Abhishek is 20 years old guy, currently living in Indore, India. He is a part time blogger.
Contact him @ Facebook

No comments:

  • Introduction to C++

    INTRODUCTION TO C++

    Our resources have been successfully downloaded over 10K times and found almost every where. Get yours!

  • QUERY MADE EASY !!!

    QUERY MADE EASY !!!

    Learn Why we chose HostGator as our Web Host and find discount coupons to kick start your blog today!

  • QUERY MADE EASY !!!

    QUERY MADE EASY !!!

    Learn every single SEO tip that will boost your blog's ranking and organic traffic. We got them all!

  • QUERY MADE EASY !!!

    QUERY MADE EASY !!!

    Why not take a tour of all great Blogger widgets published so far? You Name it we have it!

  • QUERY MADE EASY !!!

    QUERY MADE EASY !!!

    Learn what it takes to become a successful entrepreneur and build a living online!