✅❎pd()
mfp吧
全部回复
仅看楼主
level 13
function pd()
f_sc("pdt&.txt")
f_sc("pdf&.txt")
f_sc("pdt.txt")
f_sc("pdf.txt")
variable n0=0
while n0<=9
n0=n0+1
variable a1=input("№_"+n0+":? ","s")
print("»»"+iff(evaluate(a1)==True,"✅","❎")+"\n")
if(evaluate(a1)==True)
f_cc("pdt.txt","✅")
else
f_cc("pdf.txt","❎")
endif
loop
frd_trim("pdt.txt","utf_8")
variable j=f_zs("pdt&.txt")
return "得分:"+(10*j)
endf
function f_cc(s,str)
variable fp=fopen(s,"a","UTF-8")
fprintf(fp,"%s\n\n",str)
fclose(fp)
endf
function f_cc_trim(s,str)
variable fp=fopen(s,"a","UTF-8")
fprintf(fp,"%s",str)
fclose(fp)
endf
function frd_trim(s,p)
variable fp=fopen(s,"r",p)
variable str=trim(freadline(fp))
f_cc_trim("new.txt",str)
while(!feof(fp))
variable t=trim(freadline(fp))
f_cc_trim("new.txt",t)
loop
variable new_s=strsub(s,0,strlen(s)-4)+"&"+".txt"
f_gm("new.txt",new_s)
fclose(fp)
endf
function f_gm(s,t)//改名文件
copy_file(s,t)
delete_file(s)
endf
function f_sc(s)//删除文件
return delete_file(s)
endf
2016年08月10日 12点08分 1
level 13
function f_zs(path_txt)
variable fp=fopen(path_txt,"r","UTF-8")
variable n=get_file_size(path_txt)
variable str=alloc_array(n)
variable k=0
do
k=k+1
str[k]=fscanf(fp,"%c")
//variable st=str'
until(feof(fp))
return k
fclose(fp)
endf
2016年08月10日 13点08分 2
level 13
2016年08月11日 01点08分 9
找字符串的最后一个字符
2016年08月11日 04点08分
level 13
function f_xst(s)
variable fp=fopen(s,"r","UTF-8")
print("☞{当前的文本是:"+s+"}\n")
do
variable t=freadline(fp)
variable str=trim(t)
print(str+"\n")
until(feof(fp))
fclose(fp)
endf
2016年08月11日 02点08分 10
level 13
2016年08月11日 03点08分 11
level 13
function try_tf()
frd_trim("pd.txt","utf_8")
variable h=trim(f_tp("pd&.txt","utf_8",1))
variable t=strsub(h,strlen(h)-1,strlen(h))
if(t=="✅")
variable k=size(split(f_tp("pd&.txt","utf_8",1),"✅"))[0]
return "✅数:"+k
else
variable k=size(split(f_tp("pd&.txt","utf_8",1),"❎"))[0]
return "❎数:"+k
endif
endf
2016年08月11日 04点08分 14
一个文本中同时存在,"✅"和"❎"用此函数
2016年08月11日 04点08分
level 13
function f_sxjs(s,p)
//variable s="s.txt"
//variable p="utf_8"
variable fp=fopen(s,"r",p)
while(!feof(fp))
variable s=freadline(fp)
variable ans=evaluate(s)
print(s+"="+round(ans,2)+"\n")
variable name="答案.txt"
f_storage_f(name,s+"="+round(ans,2)+"\n")
loop
endf
function f_sxjs(s)
//variable s="s.txt"
variable fp=fopen(s,"r","utf_8")
while(!feof(fp))
variable s=freadline(fp)
variable ans=evaluate(s)
print(s+"="+round(ans,2)+"\n")
variable name="答案.txt"
f_storage_f(name,s+"="+round(ans,2)+"\n")
loop
endf
2016年08月12日 23点08分 18
读题,自动计算
2016年08月13日 00点08分
level 13
function f_sxjs_(s,p)
//variable s="s.txt"
//variable p="utf_8"
variable fp=fopen(s,"r",p)
while(!feof(fp))
variable s=freadline(fp)
variable sp=split(s,"==")
variable ans=evaluate(sp[0])
print(sp[0]+"="+round(ans,2)+"\n")
variable name="答案:.txt"
f_storage_f(name,sp[0]+"=="+round(ans,2)+"\n")
loop
endf
function f_sxjs_(s)
//variable s="s.txt"
variable fp=fopen(s,"r","utf_8")
while(!feof(fp))
variable s=freadline(fp)
variable sp=split(s,"==")
variable ans=evaluate(sp[0])
print(sp[0]+"="+round(ans,2)+"\n")
variable name="答案:.txt"
f_storage_f(name,sp[0]+"=="+round(ans,2)+"\n")
loop
endf
2016年08月13日 00点08分 22
提取"=="前的数学表达式进行计算
2016年08月13日 00点08分
level 5
楼主,本吧官方Q群需要你这样的大神加入。群号:475501676
2016年10月08日 12点10分 23
1