Long time no see
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
#include "func.h"
|
||||
|
||||
int mainget(void){
|
||||
int t=0,x,y=0,num=0;
|
||||
unsigned long input = 0;
|
||||
while(
|
||||
((x=getwchar())>=32 && t<100)
|
||||
&& ((x>='a' && x<='z')
|
||||
|| (x>='0' && x<= '9')
|
||||
|| (x>='A' && x<='Z'))){
|
||||
//printf("%d %lu ",x,input);
|
||||
if(x>='a' && x<='z') {x -=('a'-'A');t--;}
|
||||
if(x>='A' && x<='Z') {input = (input*100)+(x);t--;}
|
||||
//printf("%d %lu\n",x,input);
|
||||
if(input>1000000000000000000){printf("input err\n\n");flush();input=0;t--;}
|
||||
if(x>='0' && x<='9'&&num<147483647){num = (num*10)+(x-'0');t--;}
|
||||
else if(num>147483647){printf("num is too big!\n\n");num = 0;t--;}
|
||||
if(t<0)t=0;
|
||||
t++;
|
||||
if(end(x))return -1;
|
||||
}
|
||||
if(end(x))return -1;
|
||||
|
||||
int exit = 69887384;
|
||||
int help = 72697680;
|
||||
|
||||
int show = 83727987;
|
||||
|
||||
int set = 836984;
|
||||
|
||||
int func = 70857867;
|
||||
|
||||
|
||||
y=(input == exit)?-1:y;
|
||||
y=(input == 'Q')?-1:y;
|
||||
|
||||
y=(input == help)?1:y;
|
||||
y=(input == 'H')?1:y;
|
||||
|
||||
|
||||
y=(input == set)?2:y;
|
||||
y=(input == 'S')?2:y;
|
||||
if(y==2&&(num>=1&&num<=9)) y = 20+num;
|
||||
if(y==2&&(num==10)) y = 200+num;
|
||||
|
||||
|
||||
y=(input == func)?3:y;
|
||||
y=(input == 'F')?3:y;
|
||||
if(y==3&&(num>=1&&num<=9)) y = 30+num;
|
||||
if(y==3&&(num>=10&&num<=21)) y = 300+num;
|
||||
|
||||
y=(input == show)?4:y;
|
||||
y=(input == 'C')?4:y;
|
||||
|
||||
|
||||
return y;
|
||||
}
|
||||
int buffinput(int *cell, int *inbuff, int *buff){
|
||||
setlocale(LC_ALL, "");
|
||||
wint_t ch;
|
||||
*inbuff = 0;
|
||||
while((ch=getwchar())!='\n'&&*inbuff<5){
|
||||
*(buff+*inbuff)=(int)ch;
|
||||
(*inbuff)++;
|
||||
}
|
||||
// -num- -select cell ----------------------------
|
||||
if(*buff == '-'){
|
||||
*cell = 0;
|
||||
for(int i = 1;i<(*inbuff);i++){
|
||||
if( *(buff+i) >= '0' && *(buff+i) <= '9'){
|
||||
*cell = ((*cell)*10) + ((*(buff+i))- '0');
|
||||
if(*cell>99){*cell=0;}}
|
||||
else if (*(buff+i)!='-') {*cell = 0;break;}
|
||||
}
|
||||
}
|
||||
if(*(buff+(*inbuff-1))=='-'&&*cell>-1)return 1;
|
||||
//-------------------------------------------------
|
||||
|
||||
// exit -------------------------------------------
|
||||
if (*buff =='e'&&
|
||||
*(buff+1)=='x'&&
|
||||
*(buff+2)=='i'&&
|
||||
*(buff+3)=='t'){return -1;}
|
||||
//-------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user