Rabu, 12 Agustus 2015

Program Pencarian Data (Searching)

#include<iostream>
using namespace std;
main()
{
int h, j, i,idx=-1;
cout<<"Jumlah data  ";
cin>>i;
int l[i];
for(j=0;j<i;j++)
{
cout<<"Data Ke "<<j+1<<" : ";
cin>>l[j];
}
cout<<"\nMasukkan Data yang dicari : ";
cin>>h;
for(j=0; j<i; j++)
{
if(l[j]==h)
{
idx=1;
}
}
if(idx==-1)
{ cout<<"Data tidak ada \n"; }
else
{
cout<<"\nData ketemu"<<endl;
}
cout<<"\n\nOhansyah\t2014141384\t02TPLMA";
}

Share:

1 komentar:

index

Popular Posts