Source Code:
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int g[10][10],n,i,j,k;
cout<<"program for Floyd warshall (all pair shortest path)by: Tarun rawat\n\n";
Welcome to " way2cplusplus.blogspot.in " Objective of this blog is to implement various Computer Science Engineering Lab problems into C++ programming language. These are basically most common Lab Exercise problems based on the curriculum of engineering colleges throughout the Nation. These lab exercises are also relevant to Data structure. Simply C++ programming zone...
Quick Sort
Source Code:
#include<iostream.h>
#include<conio.h>
void quicksort(int*,int,int);
int partion(int*,int,int);
void main()
{clrscr();
cout<<"Enter ten number for quick sort by-Tarun rawat:\n\n";
#include<iostream.h>
#include<conio.h>
void quicksort(int*,int,int);
int partion(int*,int,int);
void main()
{clrscr();
cout<<"Enter ten number for quick sort by-Tarun rawat:\n\n";
Heap Sort (using random input)
Source Code:
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#define MAXSIZE RAND_MAX
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#define MAXSIZE RAND_MAX
0/1 Knapsack Problem
Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. In other words, given two integer arrays val[0..n-1] and wt[0..n-1] which represent values and weights associated with n items respectively. Also given an integer W which represents knapsack capacity, find out the maximum value subset of val[]
Job Scheduling
Source Code:
#include<iostream.h>
#include<conio.h>
void job(int*,int*,int,int);
void main()
{clrscr();
cout<<"Program created by Tarun Rawat Job Scheduling\n\n";
#include<iostream.h>
#include<conio.h>
void job(int*,int*,int,int);
void main()
{clrscr();
cout<<"Program created by Tarun Rawat Job Scheduling\n\n";
Fractional Knapsack
There are n items in a store. For i =1,2, . . . , n, item i has weight wi > 0 and worth vi > 0. Thief can carry a maximum weight of W pounds in a knapsack. In this version of a problem the items can be broken into smaller piece, so the thief may decide to carry only a fraction xi of object i, where 0 ≤ xi ≤ 1. Item i contributes xiwi to the total weight in the knapsack, and xivi to the value of the load.here
are n items in a store.
Calculate nPr & nCr
C++ Program to calculate nPr & nCr. This program calculates the value of nCr and nPr. The values of n and r
are input by user. We have used 3 functions : 'npr' for calculating nPr ,
'ncr' for calculating nCr , factorial to calculate factorial. nPr is
calculated by the formula nPr = factorial(n)/factorial(n-r)
Calculate Simple interest
C++ Program to calculate Simple Interest. This program calculates the simple interest and prints the result on the compiler screen.
Three values i.e principal amount(p), interest rate(r) & time period(t) are input by the user using 'cin'. All three are taken of 'float' type .
The formula for simple interest is : p*r*t/100.The result is shown on compiler screen using 'cout'.
Three values i.e principal amount(p), interest rate(r) & time period(t) are input by the user using 'cin'. All three are taken of 'float' type .
The formula for simple interest is : p*r*t/100.The result is shown on compiler screen using 'cout'.
Sum of G.P
C++ Program to calculate sum of finite G.P. This program calculates the sum of the a finite G.P. and prints the
result on the compiler screen. The first term 'a', number of terms 'n'
and the common ratio 'r' are input by the user. Sum of an G.P. is calculated by the formula : sum=(a*(1-pow(r,n+1)))/(1-r) , nth term by : nth=a*pow(r,n-1) . For loop is used to print the whole series
upto n
Calculate Sum of an A.P.
C++ Program to Calculate sum Of An A.P. series. This program calculates the sum of the an A.P. and prints the result on
the compiler screen. The first term 'a', number of terms 'n' and the
common difference 'd' are input by the user. Sum of an A.P. is
calculated by the formula : sum=(n*(2*a+(n-1)*d))/2 , nth term by : nth=a+(n-1)*d . For loop is used to print the whole series upto n and the sum is printed on compiler screen
calculated by the formula : sum=(n*(2*a+(n-1)*d))/2 , nth term by : nth=a+(n-1)*d . For loop is used to print the whole series upto n and the sum is printed on compiler screen
Calculate sum 1 + 2 + 3 +. . . .+n
C++ Program to calculate the sum of a series up to N terms.This program calculates the sum of the series 1 + 2 + 3 +. . . . . . . .
.+n and prints the result on the compiler screen. The last number n is
input by the user. Sum of this series is calculated by the formula :
sum=(n*(n+1))/2. For loop is used to print the whole series upto n and
the sum is printed on compiler screen.
Count Number of Vowels
C++ Program To count the number of Vowels in given string. This program calculates the number of vowels in a string using for loop.
The string is input by the user using gets(). Using gets() allows the
compiler to input the spaces of string also. We have taken a
variable count whose value increases by 1 when a vowel in encountered
during the scan. So value of count keeps on increasing
Inverse of a Matrix
C++ Program to Calculate the Inverse of matrix. This program finds the inverse of a matrix and prints the result on the
compiler screen. We define a 3-dimensional array 'a' of int type. It is
input by the user. The number of rows and columns are made fixed as 3.
Firstly determinant of the matrix is calculated using nested for loops
Multiply Matrices by Strassen's Method
C++ Program to multiply matrix using Strassen's
Multiplication method. This program calculates the multiplication of 2 matrices by Strassen's
Multiplication method. We define a 3 arrays : 'a' , 'b' & 'c' , all
of int type. All 3 are input by the user. The number of rows &
columns are made fix to 2. Then the multiplication is calculated by
using strassen's method and the new multiplied matrix is printed on the
screen.
QUEUE operations using Array
C++ Program for the implementation of Linear Queue operation (insert, delete & display). C++ Program to implement QUEUE operations using Array.
Queue is a abstract data type, In which entities are inserted into the rear end and deleted from the front end.
Queue based on the FIFO (First In First Out) criteria,means the element inserted first is get deleted first.
Queue based on the FIFO (First In First Out) criteria,means the element inserted first is get deleted first.
Stack Operations using arrays
C++ program for implementation of Stack (push,pop & display) operation.Stack based on the LIFO (Last In First Out) behavior means, the last
element is pushed(insert) inside the stack , is the first element to get
pop(deleted).Stack is a data structure in which the objects are arranged in a non linear order.
In stack, elements are added or deleted from only one end, i.e. top of the stack.
Here we implement the PUSH, POP, DISPLAY stack operations using the array.
check Armstrong number
C++ Program to check the input number is Armstrong number or not.
Armstrong number c++ program: A number is armstrong if the sum of cubes of individual digits of a number is equal to the number itself. For example 371 is an armstrong number as 33 + 73 + 13 = 371. Some other armstrong numbers are: 0, 1, 153, 370, 407.
Armstrong number c++ program: A number is armstrong if the sum of cubes of individual digits of a number is equal to the number itself. For example 371 is an armstrong number as 33 + 73 + 13 = 371. Some other armstrong numbers are: 0, 1, 153, 370, 407.
Transpose a matrix
C++ Program fot the Transpose of matrix.This c++ program prints transpose of a matrix. It is obtained by
interchanging rows and columns of a matrix. When we transpose a matrix then the order of matrix changes, but for a square matrix order remains same.
Subscribe to:
Posts (Atom)


























