As c and c++ are similar in many ways but there are several differences too. That we will discover later on but initially we can start up with basic knowladge of c and no matter if you are a fresher to programming languages.
#include<conio.h>
Some differences in Syntax start from here we give output by cout(Console OUT)
Syntax is cout<<
And syntax for getting an input is cin(Console IN)
Syntax: cin>>
Here is the first program for C++
- First of all we have to add headder file to our program to provide some basic pre-defined functions, that make our task easier.
- For C++
conio.h stands for Console Input Output Headder file
iostream.h
iostream.h stands for Input Output Stream Headder file
- Syntax for including headder file in c++
#include<conio.h>
#include<include.h>
- Now as we have added headder file we are set to code and dirty our fingures in some real codeing.
- The basic difference in C & C++ is that C++ have a feature that is object orient Programming that makes programming interesting by adding security and code reusability features even more easier. But at the same time c++ is not completely Object oriented instead C++ is partially object oriented.
- There is a new user defined data type called class but it is optional to use and program can run even without a class. Basically a class is a data type that comprise of pre defined data types and methods(Functions) defined within a class. There are three types of data types within a class
We will be focusing on classes later on. Rather we must start our first simple program.
- Private: These data types can only be used within a class highly protected
- Public: These data types or methods(Functions) are accessible even outside class, Very low or almost no security, and are basically used to access private or private members
- Protected: These are like Private, protected but can be inherited.
Some differences in Syntax start from here we give output by cout(Console OUT)
Syntax is cout<<
And syntax for getting an input is cin(Console IN)
Syntax: cin>>
Here is the first program for C++
No comments:
Post a Comment