Programming Tools

where students meet to knowledge


November 2016

Programming for ethical hacker

What is polymorphism? Explain function overloading with suitable example.

Polymorphism The word Polymorphism means having many forms. Polymorphism means the ability to take many forms. For instance, an operator may exhibit different behavior in different situations. In oop, polymorphism  plays an important role in allowing objects having different internal… Continue Reading →

What does inheritance means in C++?How can we make private member inheritance without modifying?

Inheritance The process of deriving a new class from an old one is called inheritance. The old class is referred to as the Base class and the new class is called the Derived Class. The Derived class may inherit some… Continue Reading →

Explain the advantages of binary search over Linear/Sequential search

Sequential search Linear searching is a searching techniques to find an items from a list until the particular item not reached at the end. We start the searching from 0 index to n-1 index in a Linear/Sequential manner, if particular… Continue Reading →

Using friend function to find the larger of two number which belong to different classes

#include<iostream> using namespace std; class B; class A { int a; public: void input(); friend void larger(A,B); }; class B { int b; public: void input(); friend void larger(A,B); }; void A::input() { cout<<“Enter a number : “; cin>>a; }… Continue Reading →

Add two complex number using operator overloading

#include<iostream> using namespace std; class Complex { int x,y; public: Complex(){} Complex(int real,int imag) { x=real; y=imag; } Complex operator+(Complex); void display(); }; Complex Complex::operator+(Complex) { Complex tmp,c; tmp.x=x+c.x; tmp.y=c.y; return tmp; } void Complex::display() { cout<<x<<showpos<<y<<“i”; } int main()… Continue Reading →

To Implement unary operator(-) using operator overloading

#include<iostream> using namespace std; class space { int x,y,z; public: void input(int a,int b,int c); void display(); void operator-(); }; void space::input(int a,int b,int c) { x=a;y=b;z=c; } void space::display() { cout<<“x=”<<x<<“\n”<<“y=”<<y<<“\n”<<“z=”<<z<<“\n”; } void space::operator-() { x=-x;y=-y;z=-z; } int main()… Continue Reading →

Function to determine if a particular item exist in the list

#include<stdio.h> #include<malloc.h> typedef struct _Node {  int val; struct _Node *next; }Node; Node *makeNode( int ); void print( Node * ); Node *locate( Node * , int ); void main( ) { Node *start = ‘\0’ , *last =’\0′ ,*nd; int n; printf(“\n”); while(1) { printf(“Enter Item : “);… Continue Reading →

© 2017 Programming Tools —