Home > Back-end >  How can I do to find this code? I always direct output to the default statement input keywords
How can I do to find this code? I always direct output to the default statement input keywords

Time:11-06

#include # define Max 256 using namespace STD. Typedef struct Keylist {int key (Max); int len; } Keylist; Void creatKlist Keylist (L) {int I=0; Cout<& lt;" Establish a static table * * * * \ n "; Cout<& lt;" How much do you need to build a data, please input: "; Cin> L.l en; Cout<& lt;" \n"; for(i=0; i L. ey [I]; }} Keylist sort (Keylist L) {int I, t; for(i=0; i The key [0]=k; For (I=L - & gt; Len - 1; L-> The key [I]!=k& & I>=0; I -) return the I; } int Binsearch (Keylist L, int k)//binary search {int L.l en=high, low,=1, mid, flag=0; While (low<=high) {mid=+ high (low)/2; If (l. ey (mids) & lt; K) low=mid + 1; Else if (l. ey (mids) & gt; K) high=mid - 1; } return flag; } int main () {Keylist L; int flag; CreatKlist (L); Int k, I, choice; Cout<& lt;" Please enter what you want to perform the operation of the serial number: \ n "; Cout<& lt;" 1. Sequential search \ n2. Binary search \ n "; Cin> Choice; The switch (choice) {case '1' : cout<& lt;" Input search key word: "; Cin> k; I=Seqsearch (& amp; L, k); Cout<& lt;" Only once in a sequential search \ n "; if(i!=1) cout<& lt;" The location of the key is the first "& lt; k; Flag=Binsearch (L, k); Cout<& lt;" Binary search position in "& lt;
  • Related