Advertisement
MasterGun

LinearSort

Mar 21st, 2021 (edited)
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. void linearSort(const int size,int arr[],int a){
  2.     for (int i = 0; i++, i < size;) {
  3.         if (arr[i] == a) {
  4.             cout << i << endl;
  5.             return;
  6.         }
  7.         cout << "ERROR #01, chosen number not found" << endl;
  8.     }
  9.  
  10. int main(){
  11.     setlocale(LC_ALL, "rus");
  12.     int a = 2;
  13.     const int size = 10;
  14.     int arr[10] = {2,5,3,6,1,9,2,10,7,8};
  15.     linearSort(size, arr, a);
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement