0% found this document useful (0 votes)
30 views3 pages

Manual # 10

Manual #10 provides an introduction to searching techniques using arrays. It discusses linear search through arrays in C++ using a for loop to search an integer array for a target data value entered by the user. The program outputs whether the data is found or not found. It also poses three questions - to write a program that detects duplicate values, implements binary search through arrays, and finds an element in a matrix.

Uploaded by

musa
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

Manual # 10

Manual #10 provides an introduction to searching techniques using arrays. It discusses linear search through arrays in C++ using a for loop to search an integer array for a target data value entered by the user. The program outputs whether the data is found or not found. It also poses three questions - to write a program that detects duplicate values, implements binary search through arrays, and finds an element in a matrix.

Uploaded by

musa
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Manual # 10

Topic:
Searching Techniques Using Arrays

Subject:
Introduction to Computing

Author:
Engr. Ali Faisal Murtaza

1
------------------------------------------------------------------------------------------------------------
Linear Search through Arrays

#include<iostream.h>

int main()
{
int i[100],size,data,k;

cout<<"Enter the Size: ";


cin>>size;

cout<<"\n";

cout<<"Enter Data:"<<endl;

for(k=0;k<size;k++)
{
cin>>i[k];
}

cout<<"\n";

for(k=0;k<size;k++)
{
cout<<i[k]<<" --> ";
}

cout<<"\n\n";

cout<<"Enter Data to search: ";


cin>>data;

for(k=0;k<size;k++)
{
if(data==i[k])
{
cout<<"Data Found"<<endl;
goto end;
}
}

cout<<"Data Not Found"<<endl;

end:
cout<<"\n\n";

2
return 0;
}
------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------
Q1: Duplication: Write a program which will take the value from the user and in case
user entered the duplication value then the programs tells that duplicate value is entered
and then after entering the value the program should be able to find out the value.
------------------------------------------------------------------------------------------------------------
Q2: Do Binary Search through Arrays
------------------------------------------------------------------------------------------------------------
Q3: Write a program which will find the element from any given matrix.
------------------------------------------------------------------------------------------------------------

You might also like