Advanced programs

Find the Area of shapes using function overloading

Find the Area of shapes using function overloading

Here is a program which will find the Area of shapes using function overloading. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ program to implement circular queue using array

C++ program to implement circular queue using array

#include <iostream.h> class cqueue { private : int *arr ; int front, rear ; int MAX; public : cqueue( int maxsize = 10 ) ; void addq ( int item ) ; int delq( ) ; void display( ) ; } ; cqueue :: cqueue( int maxsize ) { MAX = maxsize ; arr = […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

Program to implement Binary Search Algorithm

Program to implement Binary Search Algorithm

#include <iostream.h> template<class T> int binarySearch(T a[], int n, T& x) { int left = 0; // left end of segment int right = n – 1; // right end of segment while (left <= right) { int middle = (left + right)/2; // middle of segment if (x == a[middle]) return middle; if (x […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ programs to implement Graph Traversal Techniques – Depth First Search/Breadth First Search

C++ programs to implement Graph Traversal Techniques - Depth First Search/Breadth First Search

a)Program to implement Breadth first Search algorithm. #include<iostream.h> #include<conio.h> #include<stdlib.h> int cost[10][10],i,j,k,n,queue[10],front,rear,v,visit[10],visited[10]; void main() { int m; clrscr(); cout <<"enterno of vertices"; cin >> n; cout <<"ente no of edges"; cin >> m; cout <<"\nEDGES \n"; for(k=1;k<=m;k++) { cin >>i>>j; cost[i][j]=1; } cout <<"enter initial vertex"; cin >>v; cout <<"Visitied vertices\n"; cout << v; visited[v]=1; […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

Program to implement Linear Search algorithm

Program to implement Linear Search algorithm

#include<iostream.h> #include<constream.h> void read(int a[10],int n) { cout<<"reading\n"; for(int i=0;i<n;i++) cin>>a[i]; } void display(int a[10],int n) { for(int i=0;i<n;i++) cout<<a[i]<<"\t"; } void linearsearch ( int a[10],int n ) { int k,flag=0; read(a,n); display(a,n); cout<<"\nenter an element to be search\n"; cin>>k; for(int i=0;i<n;i++) { if(a[i]==k) flag=1; break; } if(flag==1) cout << "\nsearching is successful,element is found […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ program using class to generate mark sheet using multiple inheritance

C++ program using class to generate mark sheet using multiple inheritance

Using multiple inheritances, prepare a Student Mark sheet, class marks for every student in three subjects. The inherited class generates mark sheet. #include<iostream.h> #include<stdio.h> #include<dos.h> class student { int roll; char name[25]; char add [25]; char *city; public: student() { cout<<"welcome in the student information system"<<endl; } void getdata() { cout<<"\n enter the student roll […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ class program to perform complex arithmetic using operator overloading

C++ class program to perform complex arithmetic using operator overloading

Write a program to perform complex arithmetic using operator overloading #include<iostream.h> #include<stdio.h> #include<conio.h> #include<process.h> class complex { int real; float image; public: void getdata() { cout<<"\n enter the real part of the complex"; cin>>real; cout<<"\n enter the imaginary part of the complex"; cin>>image; } void operator + (complex); void operator – (complex); };   void […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ class program to perform rational number arithmetic

C++ class program to perform rational number arithmetic

Write a program to perform rational number arithmetic. #include<stdio.h> #include<iostream.h> #include<conio.h> class rational { int numer; int denom; public: void getdata() { cout<<"\n enter the numerator part of the rational no."; cin>>numer; cout<<"\n enter the denominator part of the rational no."; cin>>denom; } void operator+(rational); void operator-(rational); void operator *(rational); void operator /(rational); }; void […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ program using class to multiply by 10 to every member of a list

C++ program using class to multiply by 10 to every member of a list

Write a program using class which reads a list of N number of integer type in an array. It modifies the list by multiplying 10 to every number of the list. The modified list is displayed. #include<iostream.h> #include<conio.h> class array { public: void readarray(); void multiply(); }; void array::readarray() { int a[10]; cout<<"Enter the elements […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone