📄 飞翔理科ii.txt
字号:
{
ch=getchar();
if(ch=='b'){f=1;strcpy(fu,"AA ×");}
if(ch=='n'){f=2;strcpy(fu,"Aa ×");}
if(ch=='m'){f=3;strcpy(fu,"aa ×");}
}
strcpy(out1,fu);
strcpy(out2,"请选择母本基因型: ");
strcpy(out3,"①AA②Aa③aa ");
prout();
ch=0;
while(ch!='b'&&ch!='n'&&ch!='m')
{
ch=getchar();
if(ch=='b'){m=1;TextOut(39,35,"AA",1);}
if(ch=='n'){m=2;TextOut(39,35,"Aa",1);}
if(ch=='m'){m=3;TextOut(39,35,"aa",1);}
}
Refresh();
Delay(20);
if(f==1&&m==1)
{
win(1);
cai(4);
TextOut(3,35,"杂交 AA × AA",1);
TextOut(3,50,"配子 A A A A",1);
TextOut(99,35,"结果:",1);
TextOut(99,50,"后代全部为",1);
TextOut(3,65,"F1 AA 显性纯合子",1);
Refresh();
getchar();
}
if((f==1&&m==2)||(f==2&&m==1))
{
win(1);
cai(4);
TextOut(3,35,"杂交 AA × Aa",1);
TextOut(3,50,"配子 A A A a",1);
TextOut(99,35,"结果:",1);
TextOut(99,50,"后代全部为",1);
TextOut(3,65,"F1 AA Aa 显性基因",1);
Refresh();
getchar();
}
if((f==1&&m==3)||(f==3&&m==1))
{
win(1);
cai(4);
TextOut(3,35,"杂交 AA × aa",1);
TextOut(3,50,"配子 A A a a",1);
TextOut(99,35,"结果:",1);
TextOut(99,50,"后代全部为",1);
TextOut(3,65,"F1 Aa 显性杂合子",1);
Refresh();
getchar();
}
if(f==2&&m==2)
{
win(1);
cai(4);
TextOut(3,35,"杂交 Aa × Aa",1);
TextOut(3,50,"配子 A a A a",1);
TextOut(99,35,"结果:",1);
TextOut(99,50,"后代基因分",1);
TextOut(3,65,"F1 AA Aa aa 离比 1:3:1",1);
Refresh();
getchar();
}
if((f==3&&m==2)||(f==2&&m==3))
{
win(1);
cai(4);
TextOut(3,35,"测交 Aa × aa",1);
TextOut(3,50,"配子 A a a a",1);
TextOut(99,35,"结果:",1);
TextOut(99,50,"后代基因分",1);
TextOut(3,65,"F1 Aa aa 离比 1:1",1);
Refresh();
getchar();
}
if(f==3&&m==3)
{
win(1);
cai(4);
TextOut(3,35,"杂交 aa × aa",1);
TextOut(3,50,"配子 a a a a",1);
TextOut(99,35,"结果:",1);
TextOut(99,50,"后代全部为",1);
TextOut(3,65,"F1 aa 隐性纯合子",1);
Refresh();
getchar();
}
while(getchar()!=27);
}
//=========================================================
void mimazi()
{
int i;
char c[4];
char k;
c[3]=0;
win(1);
cai(4);
TextOut(3,35,"输入密码子:",1);
Refresh();
for(i=0;i<3;i++)
{
k=0;
while(k!='u'&&k!='c'&&k!='a'&&k!='g'&&k!=LEFT_KEY)k=getchar();
if(k==LEFT_KEY){c[i-1]=' ';i--;i--;TextOut(69,35,c,1);Refresh();continue;}
c[i]=toupper(k);c[i+1]=0;
TextOut(69,35,c,1);
Refresh();
}
win(1);
cai(4);
TextOut(3,35,"密码子:",1);
TextOut(45,35,c,1);
TextOut(3,50,"氨基酸:",1);
getnum(192,0);
pic[192]=0;
for(i=0;i<64;i++)
{
if(c[0]==pic[3*i]&&c[1]==pic[3*i+1]&&c[2]==pic[3*i+2])
{
getnum(8,192+i*8);
pic[8]=0;
TextOut(45,50,pic,1);
}
}
Refresh();
getchar();
}
//===============================================
void fanshehu()
{
openfile(3);
getchar();
}
//**********************************************************************************
char EXITorNOT()
{
return 1;
}
long fsize(char fsize_fp)
{
fseek(fsize_fp,0,SEEK_END);
return ftell(fsize_fp);
}
char fopen_fp()
{
//===================================================
strcpy(filestr,textfilename);
if ((fp=fopen(filestr,"r"))==0) return 0;
return 1;
}
char TYPEofFILE()
{
char type_flag[5];
rewind(fp);
fread(type_flag,1,5,fp);
rewind(fp);
if((!type_flag[0])&&(!type_flag[1])&&(!type_flag[2]))
{
if((!type_flag[3])&&(!type_flag[4]))return 1;//TXT
else return 2;//EBK
}
else if((type_flag[0]=='B')&&(type_flag[1]=='1')&&(type_flag[2]=='6'))return 3;//B16
else if((type_flag[0]=='B')&&(type_flag[1]=='M'))return 4;//BMP
else if((type_flag[0]=='F')&&(type_flag[1]=='L')&&(type_flag[2]=='M'))return 5;//FLM
else if(type_flag[0]&&type_flag[1]&&type_flag[2]&&type_flag[3]&&type_flag[4])return 1;
else return 0;
}
void progress()
{
char y1;
char y2;
y1=(79*(thispage_begin-dataBegin))/(dataEnd-dataBegin);
y2=1+(79*(thispage_end-dataBegin))/(dataEnd-dataBegin);
Line(159,0,159,79,1);
Line(159,y1,159,y2,0);
}
long EBK_changeNextDir()
{
long add;
char c;
long dir_return;
long dir_unknow;
while(1)
{
if(CurrentSubDir+1<Num_of_SubDir)//下一个
{
CurrentSubDir++;
CurrentSubDir_p[dir_p]=CurrentSubDir;
fseek(fp,dir_add+3+2*CurrentSubDir,0);
dir_unknow=getc(fp)+getc(fp)*256;
fseek(fp,dir[dir_p],0);
while(getc(fp)!=0xff);
dir[dir_p]=ftell(fp);
break;
}
else //回上一层
{
if(!dir_p) {return(-1);}
fseek(fp,dir_add+1,0);parentdir=getc(fp)+getc(fp)*256;
fseek(fp,parentdir,0);
Num_of_SubDir=getc(fp);
dir_add=parentdir;parentdir=getc(fp)+getc(fp)*256;
CurrentSubDir_p[dir_p]=0;
CurrentSubDir=CurrentSubDir_p[--dir_p];//if(CurrentSubDir+1<Num_of_SubDir)则上边;
}
}
while(1)//进目录
{
fseek(fp,dir_unknow,0);
c=getc(fp);
if((!c)||(dir_p>9))break;//(dir_p>9)防止意外
else
{
CurrentSubDir=0;CurrentSubDir_p[++dir_p]=0;
Num_of_SubDir=c;parentdir=dir_add;dir_add=dir_unknow;
fseek(fp,dir_add+3,0);dir_unknow=getc(fp)+getc(fp)*256;
dir[dir_p]=dir_add+3+2*Num_of_SubDir;
}
}
thispage_begin=-1;//重要!EBK_find_inBlock()中有作用
return(dir_unknow);
}
void set_nextpage()
{
char i;
char space_rest;
char tempchar;
char CanRead;
nextpage_begin=thispage_end+1;
if(nextpage_begin<dataEnd)fseek(fp,nextpage_begin,0);
else {cmd=254;return;}
CanRead=fread(filedata,1,200,fp);
if(ftell(fp)>dataEnd)CanRead=CanRead-(ftell(fp)-dataEnd);
space_rest=26*6;
for(i=0;i<CanRead;i++)
{
tempchar=filedata[i];
if(tempchar<128)
{
if((tempchar==13)||(tempchar==10))
{
space_rest=((space_rest-1)/26)*26;
if(filedata[i+1]==10)i++;
}
else space_rest--;
}
else
{
if((space_rest%26)==1)
{
if(space_rest==1){i--;break;}
space_rest--;
}
space_rest=space_rest-2;
i++;
}
if((!space_rest)||(space_rest>156)||(CanRead<=i+1))break;
}
if(filedata[i]==10)filedata[i]=0;else filedata[i+1]=0;
if(CanRead<=i+1)filedata[CanRead]=0;
nextpage_end=nextpage_begin+i;
SetScreen(1);
if(SHIFTaBYTE)filedata[0]=63;//Chr(63)='?'
printf("%s",filedata);
thispage_begin=nextpage_begin;
thispage_end=nextpage_end;
progress();
if(Auto_ByHand=='h'){do cmd=getchar();while(cmd=='q') if(CheckKey('q'))ReleaseKey(cmd);}else cmd=14;
}
void set_nextline()
{
char i;
char space_rest;
char tempchar;
char CanRead;
nextline_begin=thispage_begin;
if(nextline_begin<dataEnd)fseek(fp,nextline_begin,0);
else {cmd=254;return;}
CanRead=fread(filedata,1,30,fp);
if(ftell(fp)>dataEnd)CanRead=CanRead-(ftell(fp)-dataEnd);
space_rest=26;
for(i=0;i<CanRead;i++)
{
tempchar=filedata[i];
if(tempchar<128)
{
if((tempchar==13)||(tempchar==10))
{
space_rest=0;
if(filedata[i+1]==10)i++;
break;
}
else space_rest--;
}
else
{
if(space_rest==1)
{
i--;
space_rest--;
break;
}
space_rest=space_rest-2;
i++;
}
if((!space_rest)||(space_rest>26))break;
}
if(filedata[i]==10)filedata[i]=0;else filedata[i+1]=0;
if(CanRead<=i+1)filedata[CanRead]=0;
nextline_end=nextline_begin+i;
thispage_end=nextline_end;
set_nextpage();
}
long lastCrLfused(long thisCrLf)
{
char CrLf[2];
char data[513];
int data_p;
int temp_p;
int chars_read;
long LastCrLf;
char line_spaces_rest;
int i;
char j;
char half;
int k;
long restchars;
char not_end;
char Reach_textbegin;
CrLf[0]=10;CrLf[1]=0;data[512]=0;
i=0;j=0;LastCrLf=0;line_spaces_rest=26;
half=0;not_end=1;Reach_textbegin=0;
do {
i++;
if(Reach_textbegin){LastCrLf=dataBegin-1;break;}
if(thisCrLf-512*i>dataBegin) fseek(fp,thisCrLf-512*i,0);
else {Reach_textbegin=1;fseek(fp,dataBegin,0);}
if((chars_read=fread(data,1,512,fp))!=512)data[chars_read]=0;
data[512]=0;
if(i==-1)data[thisCrLf-0]=0;
if(Reach_textbegin)data[(thisCrLf-dataBegin)%512]=0;
data_p=data;
while ((temp_p=strstr(data_p+1,CrLf))!=NULL)
{
data_p=temp_p;
LastCrLf=ftell(fp)-chars_read+data_p-data;
}
if(LastCrLf!=0)break;
}while(1)
i=0;
if(LastCrLf-thisCrLf>10000)return((LastCrLf-thisCrLf)%26);//快速处理长段
while (not_end)
{
if((LastCrLf+i*512+512)<thisCrLf)
{
fseek(fp,LastCrLf+i*512+1,0);fread(data,1,512,fp);
if(half)k=1;else {k=0;half=0;}
for(;k<512;k++)
{
if(data[k]>127)
{
if(!(k-511))half=1;
if(line_spaces_rest==1)line_spaces_rest=26;
line_spaces_rest=line_spaces_rest-2;
k++;
}
else
{
if(line_spaces_rest==1)line_spaces_rest=26;
else line_spaces_rest--;
}
if(!line_spaces_rest)line_spaces_rest=26;
}
}
else
{
fseek(fp,LastCrLf+i*512+1,0);
restchars=thisCrLf-LastCrLf-1-i*512;
fread(data,1,restchars,fp);
if(data[restchars-1]==13)data[--restchars]=0;else data[restchars]=0;
if(half)k=1;else {k=0;half=0;}
while (k<restchars)
{
if(data[k]>127)
{
if(line_spaces_rest==1)line_spaces_rest=26;
line_spaces_rest=line_spaces_rest-2;
k++;
}
else
{
//debug[0]=data[k];debug[1]=0;debug[2]=0;
if(line_spaces_rest==1)line_spaces_rest=26;
else line_spaces_rest--;
}
if(!line_spaces_rest)line_spaces_rest=26;
k++;
}
not_end=0;
}
i++;
}
return (line_spaces_rest);
}
void set_lastpage()
{
char i;
char space_rest;
char tempchar;
char CanRead;
lastpage_end=thispage_begin-1;
if(lastpage_end>=198+dataBegin){fseek(fp,lastpage_end-198,0);CanRead=fread(filedata,1,199,fp);}
else {fseek(fp,dataBegin,0);CanRead=fread(filedata,1,lastpage_end+1-dataBegin,fp);}
space_rest=26*6;
for(i=CanRead-1;i<CanRead;i--)
{
tempchar=filedata[i];
if(tempchar<128)
{
if(tempchar==10)
{
if(space_rest%26){space_rest=space_rest/26*26;if(!space_rest)break;}
space_rest=space_rest-lastCrLfused(thispage_begin-CanRead+i);
if(filedata[i-1]==13)i--;
}
else space_rest--;
}
else
{
if((space_rest%26)==1)
{
if(space_rest==1){space_rest=0;i++;break;}
space_rest--;
}
space_rest=space_rest-2;
i--;
}
if((!space_rest)||(space_rest>250)||(thispage_begin+i-CanRead<=0))break;
}
if(filedata[CanRead-1]==10)filedata[CanRead-1]=0;else filedata[CanRead]=0;
lastpage_begin=thispage_begin-CanRead+i;//if(i>CanRead)lastpage_begin=lastpage_begin-256;//char 溢出
SetScreen(1);
if(SHIFTaBYTE)filedata[i]=63;
if((space_rest)&&(space_rest<=26*6)){if(thispage_begin-dataBegin>200){cmd=255;return;}thispage_end=dataBegin-1;set_nextpage();return;}////////
else {printf("%s",filedata+i);memmove(filedata,filedata+i,46);}
thispage_begin=lastpage_begin;
thispage_end=lastpage_end;
progress();
if(Auto_ByHand=='h'){do cmd=getchar();while(cmd=='q') if(CheckKey('q'))ReleaseKey(cmd);}else cmd=14;
}
void set_lastline()
{
char i;
char space_rest;
char tempchar;
char CanRead;
lastline_end=thispage_begin-1;
if(lastline_end>=29+dataBegin){fseek(fp,lastline_end-29,0);CanRead=fread(filedata,1,30,fp);}
else {fseek(fp,dataBegin,0);CanRead=fread(filedata,1,lastline_end+1-dataBegin,fp);}
space_rest=26;
for(i=CanRead-1;i<CanRead;i--)
{
tempchar=filedata[i];
if(tempchar<128)
{
if(tempchar==10)
{
if(space_rest!=26)space_rest=0;
else space_rest=space_rest-lastCrLfused(thispage_begin-CanRead+i);
if(filedata[i-1]==13)i--;
}
else space_rest--;
}
else
{
//debug[0]=filedata[i-1];debug[1]=filedata[i];debug[2]=0;
if(space_rest==1){space_rest=0;i++;break;}
space_rest=space_rest-2;
i--;
}
if((!space_rest)||(space_rest>250)||(thispage_begin+i-CanRead<=0))break;
}
lastline_begin=thispage_begin-CanRead+i;//if(i>CanRead)lastpage_begin=lastpage_begin-256;//char 溢出
if((space_rest)&&(space_rest<=26)){if(thispage_begin-dataBegin>200){cmd=255;return;}thispage_end=dataBegin-1;}////////
else thispage_end=lastline_begin-1;
set_nextpage();
}
long seeknextCrLf(long from)
{
long seek;
long result;
char data[513];
char CrLf[2];
CrLf[0]=10;CrLf[1]=0;data[512]=0;
seek=from;
result=0;
while(seek+512<dataEnd)
{
fseek(fp,seek,0);fread(data,1,512,fp);
result=strstr(data,CrLf);
if(result)break;
seek=seek+512;
}
if(!result){fseek(fp,seek,0);fread(data,1,dataEnd-seek,fp);data[dataEnd-seek]=0;result=strstr(data,CrLf);}
if(!result)return(dataEnd-1);
else return(seek+result-data);
}
long seeklastCrLf(long from)
{
long seek;
long result;
long Memadd;
char data[513];
char CrLf[2];
char CanRead;
CrLf[0]=10;CrLf[1]=0;data[512]=0;
seek=from;
result=0;
while(seek-512>=dataBegin)
{
seek=from-512;
Memadd=data-1;
fseek(fp,seek,0);fread(data,1,512,fp);
while(Memadd=strstr(Memadd+1,CrLf)){result=Memadd;}
if(result)break;
else seek=seek-512;
}
if(!result){if(seek-512<dataBegin){
fseek(fp,dataBegin,0);
CanRead=fread(data,1,dataBegin-seek+512,fp);
seek=dataBegin;data[CanRead]=0;
result=strstr(data,CrLf);
}}
if(!result)return(-1);
else return(seek+result-data);
}
long printOneLine(char line,long Line_begin)
{
char chars[28];
char i;
char j;
char spacerest;
char CanRead;
i=0;spacerest=26;
if(!line)filedata[0]=0;
fseek(fp,Line_begin,0);
if(Line_begin+27<=dataEnd)CanRead=fread(chars,1,27,fp);
else CanRead=fread(chars,1,dataEnd-Line_begin,fp);
chars[CanRead]=10;
while(spacerest)
{
if(chars[i]>128){i=i+2;spacerest=spacerest-2;}
else if(chars[i]==13){chars[i]=0x20;i++;spacerest--;}
else if(chars[i]!=10){i++;spacerest--;}
else break;
if(spacerest==1)if(chars[i]>128)break;
}
for(j=i;j<26;j++)chars[j]=0x20;
chars[26]=0;
strcat(filedata,chars);
return(Line_begin+i);
}
void print_6_paragraph(long page_begin)
{
char i;
char c;
long next_paragraph;
long Head_paragraph[6];
long nextCrLf;
next_paragraph=page_begin;nextCrLf=page_begin;
c=0;
while(c!=28)
{
for(i=0;i<6;i++){Head_paragraph[i]=next_paragraph;printOneLine(i,next_paragraph);next_paragraph=seeknextCrLf(next_paragraph)+1;}Head_paragraph[i]=next_paragraph;
SetScreen(1);
printf("%s",filedata);
do c=getchar();while((c!=14)&&(c!=19)&&(c!=20)&&(c!=21)&&(c!=28))
if(c==21)next_paragraph=Head_paragraph[1];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -