wklejamy.pl website for sale. You are interested in. Please contact. wklejamy@gmail.com
Click to buy coffe
Untitled
Guest 60 10th Mar, 2023
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
#define N 10 //tymczasowe
int main()
{
int t[N]; //beda zmiany na float..
int i; //inne zmienne w iare potrzeby
bool znaleziono;
int szukana;
cout<<"Program testuje algorytm wyszukiwania liniowego";
// ponizej generowanie danych
srand(time(NULL));
for (i=0; i<N; i++)
{
cout<<"t["<<i<<"]=";
cin>>t[i];
// t[i]=rand() % 32700;
// t[i]=i;
// t[i]=-i;
// t[i]=5;
// cout<<"t["<<i<<"]="<<t[i]<<endl;
}
//PONIZEJ TESTOWANY algorytm
cout<<"Podaj szukana wartosc: ";
cin>>szukana;
for (i=0; i<N; i++)
if (t[i]==szukana)
{
cout<<"znaleziono pod indeksem "<<i<<endl;
znaleziono=true;
}
if(!znaleziono)
cout<<"Nie znaleziono"<<endl;
//Koniec algorytmu
// Tu wenetualne wyniki, komunikaty
// koniec algorytmu
return 0;
}
To share this paste please copy this url and send to your friends
RAW Paste Data