C++ Program Show Maximum Number By Using Function
Function:
Functions are self contained modules of code that accomplished a specific task. function usually take data , process it and return a result.
Object oriented programming:
Object Orientation is a technique for system modeling. Object Oriented Model consists of several interacting objects. An object is: Something tangible, e.g. Ali, Car, House, Tree. Something that can be apprehended intellectually, e.g. Time, Date. An object has a state also known as attribute, well defined behaviour or operations and a unique identity.Object oriented programming:
code:
#include<iostream>
using namespace std;
void main()
{
void maximum(int, int);
int number1, number2;
cout << "Enter 1st Number:";
cin >> number1;
cout << "Enter 2nd Number:";
cin >> number2;
maximum(number1, number2);
system("pause");
}
void maximum(int n1, int n2)
{
if (n1 > n2)
cout << "Maximum Number is\n" << n1;
else
cout << "Maximum Number is\n" << n2;
}
0 comments:
Post a Comment