object oriented programming chapter 1

28
Example 1 : First #include<iostream.h> int main() { cout<<"Hello\n"; return(0); } Example 2 : Program to illustrate Arithmetic Operators # include <iostream.h> int main( ) { int a =54, b = 20 ; // Dynamic initialization cout <<" \n a = "<<a<<" and b = "<<b ; cout<<" \n a + b = " << a+b ; // 54 + 20 cout<<" \n a - b = " << a - b ; // 54 - 20 cout<<" \n a * b = " << a * b ; // 54 * 20 cout<<" \n a / b = " << a / b ; // 54 / 20 cout<<" \n a % b = " << a % b ; // 54 % 20 return 0; } Example 3 : Program to illustrate Associative law for Arithmetic Operators # include <iostream.h> int main( ) { int a, b, c, d, e, f; a = 5, b = 2 ;

Upload: jaikumarguwalani

Post on 03-Oct-2015

218 views

Category:

Documents


1 download

DESCRIPTION

Object Oriented Programming Simple Programmes

TRANSCRIPT

/* Program to illustrate Arithmetic Operators */

Example 1 : First

#include

int main()

{

cout