Nov
28
2008

C++ Program for Linear search

C++ Program for Linear search

/**************************************************************	
	Author: Arun Vishnu M V
	Web: www.arunmvishnu.com
	Description: C++ Program for Linear search.
***************************************************************/
#include;   	
#include;  
void main()
{
	int array[100],n,found=0,i,find;
	clrscr();
	cout<<"How many numbers--> ";
	cin>>n;
	cout<<"Enter "<>array[i];
	cout<<"Enter a number to find--> ";
	cin>>find;
	for(i=0;i < n;i++)
	{
		if(array[i]==find)
		{	
			found=1;
			cout<<"\n" << find << " found at position: " << (i+1);
		}
	}
	if(found==0)
		cout<<"\nSorry! " << find << " does not found.";
	getch();
}

//---------------------- END--------------------

Related Posts

Author: Arun Vishnu

5 Comments + Add Comment

  • requested
    i want these program plz sed me

  • explain please…

  • pyare arun ji
    mujhe aap se ek baat kehni hai
    .
    .
    .
    .
    .

    ..

    .
    .
    .
    .

    ..
    .

    .
    .
    .
    .
    .
    .
    .

    ..
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .

    .
    .
    .
    .
    .
    .
    ..
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .

    .
    .

    .
    .
    .

    .
    .
    ..

    .
    ..

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .

    aapke program mein 8 error ate hai . yeh btao braces shuru ek bar krke 3 bar aap khatm kaise kr skte ho :) ))))) :P

  • @Rishu :-) .. The program is correct, but the formating plugin i uses in this site is removing few portions of the program in specific patter. I have updated the pattern

  • i have a some problem in this prgram

Leave a comment

Archives

Highslide for Wordpress Plugin