?? 6_22.cpp
字號:
// 6_22.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int index(char *s,char *t)
{
int i;
int j;
int k;
for(i=0;s[i]!='\0';i++)
{
for(j=i,k=0;t[k]!='\0'&&s[j]==t[k];j++,k++)
;
if(t[k]=='\0')
return i;
}
return-1;
}
int main(int argc, char* argv[])
{
int n;
char stl1[20],stl2[20];
cout<<"輸入一個英語單詞:";
cin>>stl1;
cout<<"輸入一個另英語單詞:";
cin>>stl2;
n=index(stl1,stl2);
if(n>0)
cout<<stl2<<"在"<<stl1<<"中左起第"<<n+1<<"個位置。"<<endl;
else
cout<<stl2<<"不在"<<stl1<<"中。"<<endl;
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -