Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion exercises/verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,26 @@ The number 3 is [not] present in the array.
#include <iostream>
using namespace std;

bool verify(int A[], int size_of_A){
int key;
cout << "inserire la chiave: "<< endl;
cin >> key;
for(int i = 0; i< size_of_A; i++){
if(key == A[i]);
return true;
}
return false;
}


int main()
{
// placeholder
int N[10] = {3, 4, 5, 1, 2, 3, 4, 9, 13, 0};

if (verify(N, 10)){
cout << "E' presente l'elemento!"<< endl;
}else{
cout << "Non è presente l'elemento!"<< endl;
}
return 0;
}