?? shunxu.cpp
字號:
#include<iostream.h>
#define N 10
typedef int keytype ;
typedef int elemtype ;
typedef struct
{ keytype key; /* 關鍵字類型 */
elemtype other; /* 其它域 */
}sqlist; /* 順序表 */
sqlist R[N+1];
int seqsearch(sqlist R[],int k)
{
int i=N;
R[0].key=k;
while(R[i].key!=k)
i--;
return i;
}
void main()
{
int x,i;
cout<<"Creat the sqlist:";
for(i=1;i<=N;i++)
cin>>R[i].key;
while(1)
{
cout<<"Input the key you want to search:";
cin>>x;
int a=seqsearch(R,x);
if(a!=0)
cout<<"It is the " <<a<<"'th key!"<<endl;
else cout<<"It is not in the sqlist!"<<endl;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -