Skip to main content

Introduction to C++

c++ was developed from C language but heavily influenced by object oriented language.c++ retains the c language as a subset of the new language. but adds support for OOP and improves up on the original extra functionality. Including language extension. Third party class libries and ANSI standard template library.

Language and methodologies:
Several languages have been developed to support OOP.The early 1960’s simula was developed with many features of todays object oriented language.Simula formed the corner stone of modern object oriented languages such as smalltalk,Eiffel,c++ and java .c++ evolved from non oop’s language C and object oriented feature grafted into the base language. java has built on c++ by stressing the object oriented part but removing difficult areas such as pointer and multiple inheritance.


INPUT/OUTPUT in C++
The header file iostream.h contains all the definition for c++ input/output classes.

Input using cin(object)
It is an object belong to istream class .when program executes it accepts the data from keyboard.
Eg:
Int number;
Cin >>number;
Note: >> is an operator to accept data from keyboard.

Cout object
This object belongs to ostream class which displays the data in screen.
Cout << “hello” << endl <<”world”;
Cout<< number;
Note: << operator to print in screen endl is a manipulator the prints new line.

#include directive
the # include directive instructs the compiler to include the contents of the file enclosed with in angular brackets into the source file.

Void main()
Main() is a function name.All program must have main function main().the execution of the program starts with the main function.The keyword void along with the function name specifies that the function doesn’t return any value.

Fundamental data types.
Data types used for actual data representation in memeory.
Data type
No of bytes
Used for
Char
1
Character/string
Int
2/4
Integer value
Float
4
Floating point number
Variable :
Values can be assigned to variable ,which can be changed in the course of program execution.The values assigned to variable is placed in the memory allocated to that variable.Variable can be created using the keyword int,char and float.

#include<iostream.h>
#include<conio.h>
void main()
{
int ivar;
char cvar;
float fvar;
clrscr();
//cplus first file
ivar=5;
cvar='a';
fvar=50.02;
cout << "integer value is:\t"<<ivar<<endl;
cout << "character  value is:\t"<<cvar<<endl;
cout << "floating value is:\t"<<fvar<<endl;
getche();
}

wap to convert from Celsius into farenheight

#include<iostream.h>
#include<conio.h>
void main()
{
float ftemp;
//float fcels;
clrscr();
cout << "enter the temperature in foreimheight\t";
cin >>ftemp;
float fcels=(ftemp-32)*5/9;
cout <<"the evuivalent temperature in celcius\t"<<fcels;
getche();
}

  

Comments

Popular posts from this blog

download Tally erp 9 With nepali date

The security of data, financial or otherwise, has always been a matter of concern most business depend on the confidentiality of information. Tally vault is an enhanced security system which allows for encryption of the company data with the most secure method of encryption being use. Tally vault ensures that under no circumstances, the original information is available in any form. The techniques could be liked to "encryption - decryption on the fly" and decrypted form of the data is never stored in the system. Apart from this, it user the "Non-stored Password" mechanism. by using highly advanced mechanism to validate a new user without any prior knowledge of the original password. The combination of these facilities means, that Tally Vault becomes one of the most secure means of information storage.  Download tally erp 9 https://drive.google.com/open?id=1bqE6AkfU0UVSeGLRhGDpZRV5BJcfFaLR

How to assemble computer CPU Step by step || IT Tech

MCB box connection || IT TECH