×
Study like there’s no tomorrow because if you keep putting off your studies for tomorrow, you’ll probably be too late.
--Your friends at LectureNotes
Close

Note for Object Oriented Programming Using Cpp - OOP By Shekharesh Barik

  • Object Oriented Programming Using Cpp - OOP
  • Note
  • Biju Patnaik University of Technology Rourkela Odisha - BPUT
  • Computer Science Engineering
  • 3 Topics
  • 6595 Views
  • 128 Offline Downloads
  • Uploaded 1 year ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

Difference between C and C++ C C++ 1. It is a procedure oriented programming. 1. It is an object oriented programming. 2. It does not support classes and object. 2. It supports class and object. 3. In c function can’t be declared inside the structure. 3. In C++ function can be declared inside the structure. 4. It does not support inline function. 4. It supports inline function. 5. It does not support function overloading. 5. It supports function overloading 6. In C scanf function is used for inputting the data. 6. In C++ Cin object is used for accepting the data. 7. The printf function is used for output of the data. 7. In C++ Cout object is used for output 8. C does not support operator overloading and inheritance. 9. It does not support reference variable. 8. C++ supports operator overloading and inheritance. 9. It support reference variable. Data Type Built in voidtype fl Integral Void Derived Floating point  int  float  char  double User defined Array Structure Function Enum Pointer Class Reference Union

Text from page-2

Operators in C++ 1. Arithmetic operator :– (+, -, *, /, %) 2. Relational operator : –(> ,< ,>= ,<= ,==) 3. Logical operator :– (&&,||, ! ) 4. Assignment operator :– (= ,+= ,-= ,*= ,/= ,%= ) 5. Increment /decrement operator :– (++ ,-- ) 6. Bitwise operator :– (& ,! ,>> ,<<) 7. Conditional operator :– (? :) 8. Special operator :–(comma (,) size of () ) 9. Unary operator :–(++,-- ,-) 10. Binary operator :–( +,- ,/ ,* ,> ,<= ,== ) Wap to print a message #include<iostream.h> void main () { cout<<”hellow world”; } Cout << insertion operator Object of ostream class Cin >> extraction operator Object of istream class

Text from page-3

WAP to find the sum of 2 nos #include<iostream.h> void main () { int a,b,c; cout<<”enter two nos ”; cin>>a; cin>>b; or cin >> a>>b; c=a+b; cout<<” result =”<< c ; } WAP to accept the length and breadth of a rectangle and find the area and perimeter. #include<iostream.h> void main () { int l, b, a, p; cout<<”enter the length and breadth ”; cin>>l; cin>>b; a= l *b; p=2(l+b); cout<<” area =”<< a<<” \n”; cout<<” perimeter= “<< p; } WAP to accept a temp in Fahrenheit and convert it into centigrade. #include<iostream.h> void main () { float f,c; cout<<”enter the temp in fahrenheit”; cin>>f; c= (5*(f-32))/9; cout<<” centigrade =”<< c; }

Text from page-4

WAP to accept the 3 sides of a triangle & find the area #include<iostream.h> #include<math.h> void main () { float a,b,c,s,a; cout<<”enter the 3 sides of the triangle”; cin>>a>>b>>c; s=(a+b+c)/2; a=sqrt(s*(s-a)*(s-b)*(s-c)); cout<<” area =”<< a; } WAP to accept the 2 nos and swap with each other #include<iostream.h> void main () { int a,b,c; cout<<”enter the 2 no.s”; cin>>a>>b; c=a; a=b; b=c; cout<<” after swapping =”<<a<<b; } Wap to accept the employee-id, basic salary and name of an employee and calculate the da,hra & gross according to the following rules DA=50% of BASIC HRA= 20% of BASIC GROSS=BASIC+DA+HRA

Lecture Notes