C program to sort an array using selection sort
#include <stdio.h> #define N 100 void sort(int [],int); main() { int i,n; int a[N]; printf("Enter the size of the ar...
Hello guys, I am Dreek. In this blog, I will post programs in various languages which will be useful for students.
#include <stdio.h> #define N 100 void sort(int [],int); main() { int i,n; int a[N]; printf("Enter the size of the ar...
#include <stdio.h> #define N 100 void quicksort(int [],int,int); int partition(int [],int,int); main() { int i,n; int a[N]...
#include <stdio.h> int power(int,int); main() { int x,y,c; printf("Enter the value of x\n"); scanf("%d...
#include <stdio.h> #include<string.h> #define N 50 void STRING_MATCH(char t[],char p[]) { int tlen,plen,i,j,limit; pl...
#include <stdio.h> #include<math.h> void nqueen(int,int); int place(int,int); int x[10]; main() { int n; printf(...
#include <stdio.h> #define N 100 void mergesort(int [],int,int); void merge(int [],int,int,int); main() { int i,n; int a[N...
#include<stdio.h> typedef struct STR { int m[10][10]; int s[10][10]; }mat; void matrix_chain_order(int [],int); main() ...
#include<stdio.h> main() { int i,k,n; printf("Enter the size of the array\n"); scanf("%d",&n); in...
#include <stdio.h> #define N 100 void sort(int [],int); main() { int i,n; int a[n]; printf("Enter the size of the ar...
#include <stdio.h> #define N 100 void heapsort(int [],int); void heapify(int [],int,int); main() { int i,n; int a[N]; pr...
#include<stdio.h> #define N 20 void graph_colour(int); int is_safe(int); int adj[N][N],x[N],n,m; main() { int i,j; print...
#include<stdio.h> main() { int i,t,c,j,k,n; printf("Enter the size of the array\n"); scanf("%d",&n)...
!/bin/bash if [ -f $1 ] then echo " $1 File exist " else echo " File does not exist " fi
!/bin/bash echo " Enter the lenght of series " read n t1=0 t2=1 s=`expr $t1 + $t2` echo " $s " for((i=0;i<n...
!/bin/bash read -p "Enter a sentence " s a=$( echo $s | tr -cd 'AaEeIiOouU' | wc -c) echo " Number of vowels $...
!/bin/bash echo " Enter a number " read a echo " Enter another number " read b echo " Enter your choice 1....
GNU nano 2.9.3 prime !/bin/bash echo "Enter a number" read n for...
!/bin/bash echo "Enter a number" read n s=1 for((i=1;i<=n;i++)) do s=`expr $s \* $i` done echo "Factori...
!/bin/bash if [ $1 -gt $2 -a $1 -gt $3 ] then echo " $1 is largest " elif [ $2 -gt $3 ] then echo " $...
#!/bin/bash echo "Enter the first number" read a echo "Enter the second number" read b c=`expr $a + $b` echo ...
#include<iostream> #include<fstream> #include<string.h> using namespace std; int main() { char chprev,ch; int ...
#include <iostream> #include <vector> using namespace std; void display(vector<int> &v) { for(int i=0;i<v....
#include <iostream> #include <map> #include<string> using namespace std; int main() { string name; int number;...
#include <iostream> using namespace std; class M { public: void display() { for(int i=1;i<=50;i++) { if(i%2==0...
#include <iostream> using namespace std; void test(int x) { try { if(x==1) throw x; else if(x==0) throw 'x'; ...
#include<iostream> using namespace std; int calculate(int x, int y, int z) { return(z/(x-y)); } int main() { int x,y,z; ...
#include<iostream> using namespace std; class A { public: void pattern(int n) { int m=(n+1)/2,k; int nstar,i,j,n...
#include <iostream> using namespace std; namespace nm { class test { private: int m; public: test(int a) { ...
#include<iostream> using namespace std; class shape { public: double ar; virtual void area()=0; //pure virtual function ...
#include<iostream> #include<cmath> using namespace std; template<class T> void root(T a,T b, T c) { T d=b*b-4*a*...
#include<iostream> using namespace std; template<class T> class array { T *arr; int size; public: array(int n) ...
#include<iostream>//error using namespace std; class MyIncrClass { private: int mCounter; public: MyIncrClass() { ...
#include<iostream> using namespace std; class A { int a; char b; public: A():a(100),b('m') { cout<...
#include<iostream> using namespace std; class Searching { int arr[100]; int n; public: friend void search (Searching sr...
CALL BY VALUE #include<iostream> using namespace std; void swap(int a,int b) { int temp; temp=a; a=b; b=temp; } int ...
#include <iostream> using namespace std; class B; class A { private: int a; public: void inputdata() { cout...
#include <iostream> using namespace std; class Calculator { private: float val; public: void getData() { cout...
#include <iostream> using namespace std; class Box { double length; double breath; double height; public: double getv...