introduction to c++

introduction to c++

introduction to c++
introduction to c++

From this article we are going to start c++ tutorials `

C++ is a general purpose object oriented programming language, developed by Bjarne Stroup. C++ is considered to be an intermediate programming language , and it has both features high level and low level language. It is dried from C language . C++ has all properties with addition concept of Classes. it was give another name  (C++) in 1983.

C++ is mostly use in Windows application , game development and rendering engines

To run C++ Program . you can use any tool here are some Tool :

Or you can use Online tool to run C++ Program .

ideone.com.

To run C++ Program  in ideone.com , select C++ language at bottom of editor, write your C++ code and run.

introduction to c++

Let’s start C++ tutorials with a very basic  introduction to C++ program.   Save it as source file. It will simply print a sentence on screen.

although  its   small size [Program , this program  “introduction to c++” demonstrates a great deal about construction of c++ basics.

Its Explanation :

Header files:

cout and other objects you used in your program use <#include> header file that holds declaration of any function you use in  your program.

You can use #include in two ways. The angle brackets < and > surrounding filenames IOSTREAM example indicate that compiler should begin searching for these files in standard Include directory . This directory , which IS traditionally called include.

Whitespace :

Whitespace is defined as space, carriage return, linefeeds , tabs, vertical tabs. These charterers are invisible to the compiler. You can put several statement on one line, separated by any number of spaces or tabs, or you can run a statement over two or more.

Function :

First which statement which is executed when you run C++ Program is main().If you don’t use  main function in your program, an error will be reported when you run program.Function are one of the essential structure block of C++. The body of a function is surrounded by braces . These braces play a same role as begin and end keyword in some other languages. They surrounded by block of stamen program. Each function must use of this couple of brackets()  around function body.

Program statement :

Program statement is important unit of ( C++ Programming language) . in above program following two statement are used..

And

return 0;

The first statement  tell the computer to display quoted space. Most statement tell the computer to do something .  in this respect , stament in C++ are similar to statement in other language. A semicolon signals end of statement  . the last statement in function body is return 0, . This tells main() function  return value 0 to whoever called it. In this case operating system or compiler.

Output using cout:

This statement cause to display string on screen in Quotation. How does this work? A complete description of this statement  requires an understating of objects, operator overloading ,and other topic .but for your understanding  and  concern , I’m  going  to briefly explain  it. The identifier cout is actually an object. It is predefined in C++ to correspond to the standard output stream. A stream is an abstraction that refers to a flow of data .output stream generally flows to screen display. The operator << is called the insertion  operator . it direct contents of variable on its right to object on its left. In first it directs the string constant  “This is my first program in C++”  to cout , which send it to display.

Comments:

Comments are essential part of program . they help person writing a program , and anyone else who must read source file , understand what is going on.  Compiler don’t execute  comments , they are not add to file size.

How to write comments :

Comments syntax:

Comments start with a pair of slash symbol (//) and terminate at end of line.

when to use comments:

comments are almost always a good thing ,most programmers don’t use enough of them.If you  are interested to leave out comments, remember that not everyone is as smart as you; they many need more explanation than you do about what your program is doing. Also, if you read you own written  program after some month and you have forgotten details of your program, comments can help you . So, you should be use comments , when it is needed.

Leave a Comment