P. 1
C++ Notes Complete

C++ Notes Complete

Ratings: (0)|Views: 2,386|Likes:
Published by ankitsaxena88

More info:

Published by: ankitsaxena88 on Mar 27, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





C C++
#include <stdio.h> #include <iostream.h>Function <printf cout. in are objectsScanf cout << Hello;Insertion operator Or Insertorscout << “value =” <<a;No need of format specefiersIn C++Scanf ( %d, &a); cin >>a;Extraction operator Or Extractor cin >>a >>b;Cascading of extractor;for next linePrintf ( “Hello \n user”); cout << “Hello \n User”;Or cout << “Hello” <<end<<”User”;In C, default return type in C++ default returnis “void” type is an “integer”
Bjarne stroustrapLab
Bell LabsCompany
At & TC is procedure oriented language C is object oriented languageEasy & fast programming in C++ closely models sear worldC. Logics can be easily developed problems Developed.
In structure of C :- only data can be member of structure and not functionsAll member of structure of are public by defaultIn class of C++ data + functions accessing those data are member of class and Allmember of class are private by defaultclass stud{int roll;char grade;float par;public:void get( );void show( );};void stud : : get( ){cout << “enter roll. Grade and per”;cin>>roll>> grade >> per;}void stud : : show{cout <<roll << “ “<< grade << “ <<per<< end1;}void main( ) roll{ getstud s;s. get ( ); s show grades. show( );}Per Function are never seplicated there is only one copy of function no matter nowmany objects are created only once memory is allocated to functions for all objectswhere as multiple copies of data are created for multiple objects.
: : Scope resolution operator helps compiler to identify functions of which class if two classes have the same name.Q. 1 wap to add two numbers give by user class add{int a, b, c;public :void get( );void sum( );void show( );};void add : : get ( ){cout << “Enter no”;cin >> a >>b;}void add : : sum( ){c= a+b;}void add : : show( ){cout << “Numbers are = “<< a << “ “ << b;cout << “sum =” <<c;}void main( ){add obj;obj. get( );obj.sum( );obj. show( );getch( );}

Activity (15)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
rel786 liked this
Somika Tamang liked this
Rhoda Owiti liked this
Aarti Gaur liked this
Saufal KaReem liked this
Rishu Jain liked this
Prasenjit Guha liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->