#include<iostream.h>
#include<conio.h>
class bubbleShort
{
int size, a[100];
public:
void getdata();
void sorting();
};
void bubbleShort :: getdata()
{
int i;
cout << "\nEnter total number of elements: " ;
cin >> size;
cout << "\nEnter elements: ";
for(i=0;i<size;i++)
cin >> a[i];
cout << "\nEntered elements are: ";
for(i=0;i<size;i++)
cout << a[i] << " ";
}
void bubbleShort :: sorting()
{
int i,j,temp;
for(i=1;i<size;i++)
{
for(j=0;j<size-i;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
cout << "\nElements After Shorting:";
for(i=0;i<size;i++)
cout << "\n" << a[i];
}
void main()
{
clrscr();
bubbleShort bsrch;
bsrch.getdata();
bsrch.sorting();
getch();
}
there is some good c ,java, sql and vb6 programs,Windows tricks, sms shorthand etc
Thursday, March 29, 2012
WAP of Bubble Short in C++
/*WAP of Bubble Short in C++*/
WAP of Linear Search in C++
/*WAP of Linear Search in C++*/
#include<iostream.h>
#include<conio.h>
class linearSearch
{
int size, a[100],item;
public:
void setData();
void searchItem();
};
void linearSearch :: setData()
{
int i;
cout << "\nEnter total number of elements: " ;
cin >> size;
cout << "\nEnter elements: ";
for(i=0;i> a[i];
cout << "\nEnter Item which you want to find: ";
cin >> item;
}
void linearSearch :: searchItem()
{
int k=1, loc=0;
while(loc==0 && k<=size)
{
if(item == a[k-1])
{
loc = k;
}
k +=1;
}
if(loc==0)
cout << "\n" << item << " isn't Found.";
else
cout << "\n" << item << " at Location " << loc;
}
void main()
{
clrscr();
linearSearch bsrch;
bsrch.setData();
bsrch.searchItem();
getch();
}
WAP of Matrix Multiplication in Java
/*WAP of Matrix Multiplication in Java*/
import java.lang.*;
import java.io.*;
import java.util.*;
class matrix
{
public static void main (String args[]) throws IOException
{
int a[][] = new int[2][2];
int b[][] = new int[2][2];
int c[][] = new int[2][2];
Scanner sc = new Scanner(System.in);
System.out.println("Enter Elements of Matrix 1");
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)
{
a[i][j] = sc.nextInt();
}
}
System.out.println("Enter Elements of Matrix 2");
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)
{
b[i][j] = sc.nextInt();
}
}
// calculation
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)
{
for(int k=0; k<2; k++)
{
c[i][j] += a[i][k] * b[k][j];
}
}
}
System.out.println("Matrix After multiplication");
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)
{
System.out.println( "\t" + c[i][j] );
}
}
}
}
Tuesday, March 20, 2012
WAP of Simpson's 1/3
/* WAP of Simpson's 1/3 */
#include<stdio.h>
#include<conio.h>
void main()
{
float x[100],y[100],odd, even,fx,h;
int size,i;
clrscr();
printf("How many value you want to enter: ");
scanf("%d",&size);
for(i=0; i<size; i++)
{
printf("Enter elements of x[%d]:\n",i);
scanf("%f",&x[i]);
printf("Enter elements of y[%d]:\n",i);
scanf("%f",&y[i]);
}
h = x[2]-x[1];
printf("\nh = %f",h);
for(i=1; i<size-1; i++)
{
if(i%2==0)
{
even += 2*y[i];
}
else //if(i%2 != 0)
{
odd += 4*y[i];
}
}
fx = ( h/3) * ( y[0] + y[size-1] + odd + even );
printf("\nf(x)= %f",fx);
getch();
}
Subscribe to:
Posts (Atom)
How to earn online
How to earn online:
Step - 1 :
signup for PayPal, to recieve your online earning
click here:
https://www.paypal.com/in/mrb/pal=CZ7224TZBMCBL
step - 2 : Singup these 4 sites & earn & enjoy! Read site to know how to earn.
1. trekpay
Earn up to $0.02 (2 cents) per click.
http://www.trekpay.com/?ref=34690
2. neobux
Earn up to $0.02 (2 cents) per click.
Click here:
http://www.neobux.com/?r=Moneyearner786
Step - 1 :
signup for PayPal, to recieve your online earning
click here:
https://www.paypal.com/in/mrb/pal=CZ7224TZBMCBL
step - 2 : Singup these 4 sites & earn & enjoy! Read site to know how to earn.
1. trekpay
Earn up to $0.02 (2 cents) per click.
http://www.trekpay.com/?ref=34690
2. neobux
Earn up to $0.02 (2 cents) per click.
Click here:
http://www.neobux.com/?r=Moneyearner786