Long time no see
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
#include <locale.h>
|
||||
|
||||
int alpha(wchar_t x);
|
||||
|
||||
int main() {
|
||||
setlocale(LC_ALL, "");
|
||||
wchar_t x;
|
||||
while((x = getwchar()) != WEOF){
|
||||
if(iswalpha(x)){
|
||||
wprintf(L"%lc - %d\n",x,alpha(x));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int alpha(wchar_t x){
|
||||
if (x >= L'A' && x <= L'Z')
|
||||
return x - L'A' + 1;
|
||||
else if (x >= L'a' && x <= L'z')
|
||||
return x - L'a' + 1;
|
||||
else if (x >= L'А' && x <= L'Я')
|
||||
return x - L'А' + 1;
|
||||
else if (x >= L'а' && x <= L'я')
|
||||
return x - L'а' + 1;
|
||||
else if (x == L'Ё' || x == L'ё')
|
||||
return 7;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
Reference in New Issue
Block a user