1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include <iostream>
#include <iomanip>
#include <cstdio>
#define A 30
using namespace std;
int search(char arr[],int len,char num){
int i;
for(i=0;i<len;i++){
if(arr[i]==num){
return i;
break;
}
}
return -1;
}
int main() {
int x,ii,defalf;
char input,alfb[A] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','?','.',','};
std::string msg;
defalf = 0;
for(ii=0;ii<A;ii=ii+1) {
scanf("%c",&input);
x = search(alfb,A,input);
cout << "\n" << x << "\n";
}
system("pause");
}
|