Write a program to search an element in an array (Linear searching)

Size of array is taken from user.. Elements are entered.. Then user is asked to enter element to be searched.. Search is performed..
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include<iostream.h>

  2. #include<conio.h>

  3. void main()

  4. {

  5. clrscr();

  6. int ar[10],n,num,no;

  7. cout<<"Enter size of the array: ";

  8. cin>>n;

  9. cout<<"Enter array element: "<<endl;

  10. for(int i=0;i<n;i++)

  11. {

  12. cout<<"Enter element "<<i<<": ";

  13. cin>>ar[i];

  14. }

  15. //Coding by: Snehil Khanor

  16. //http://WapCPP.blogspot.com

  17. cout<<"Elements of array: "<<endl;

  18. for(i=0;i<n;i++)

  19. cout<<"Element at index number "<<i<<" is: "<<ar[i]<<endl;

  20. //////To search////

  21. cout<<"Enter number to search: ";

  22. cin>>num;

  23. for(i=0;i<n;i++)

  24. {

  25. if(num==ar[i])

  26. {

  27. cout<<"Found at index number: "<<i;

  28. no=0;

  29. break;

  30. }

  31. else

  32. {

  33. no=1;

  34. continue;

  35. }

  36. }

  37. if(no==1)

  38. cout<<"Sorry your search returned NO results. :(";

  39. getch();

  40. }

Check out this stream