by sarkarijob | Sep 18, 2016 | c++ programming
//wap in c++ to illustrate the friend function,here we are finding mean of two numbers.#include<iostream>using namespace std;class sample{ int num1,num2; public : void setval(); /*here we are passing sample as argument as we are going to pass objects as argument...
by sarkarijob | Sep 18, 2016 | c++, c++ programming
Constructorconstructor is a special type of function or method in which there is No return type(Even void) and constructor name will be same as the name of the class.There are two types of constructor1.default constructor2.parameterised constructorPassing Objects as...
by sarkarijob | Sep 18, 2016 | c++, c++ programming
//To display the values of parameterised constructor.#include<iostream>using namespace std;class add{ int num1,num2,sum; public : add(int x,int y); void display();};add::add(int x,int y) { num1=x; num2=y; sum=x+y; }void add::display() {...
by sarkarijob | Sep 18, 2016 | c++ programming
//wap to calculate the sum of 2 interger no. by using constructor concept#include<iostream>using namespace std;class sum{ int a,b,s; public: sum(int ,int ); void display();};sum::sum(int x ,int y){ a=x; b=y; s=a+b;}void sum::display(){ cout<<“The sum...
by sarkarijob | Aug 21, 2016 | c++ programming
#include<stdio.h>void selection_sort(int arr[],int num);int main(){int arr[100],num,i;printf(“Enter the size of arrayn”);scanf(“%d”,&num);printf(“nEnter the elements in array one by...
by sarkarijob | Aug 21, 2016 | c++ programming
#include<stdio.h>void bubble_sort(int [],int num);int main(){int arr[100],num,i;printf(“n Enter the size of the arrayn”);scanf(“%d”,&num);printf(“n Enter the elements in the array one by...