Writes a value in a profile file for a PowerBuilder application.
Syntax
SetProfileString ( filename, section, key, value )
Argument Description
filename A string whose value is the name of the profile file. If you do not include the full path in filename, PowerBuilder searches the DOS path for filename.
section A string whose value is the name of a group of related values in the profile file. If section does not exist in the file, PowerBuilder adds it.
key A string whose value is the key in section for which you want to specify a value. If key does not exist in section, PowerBuilder adds it.
value A string whose value is the value you want to specify for key.
Return value
Integer. Returns 1 when it succeeds and -1 if it fails because filename is not found or cannot be accessed. If any argument's value is null, SetProfileString returns null.
INTEGER LI_NUMBER,LI_3W,LI_2W,LI_1W
STRING LS_NUMBER,LS_SHXN
FOR LI_NUMBER=100 TO 999
LI_3W=LI_NUMBER/100
LI_2W=MOD((LI_NUMBER/10),10)
LI_1W=MOD(LI_NUMBER,10)
IF LI_NUMBER<>LI_3W^3 +LI_2W^3 +LI_1W^3 THEN
CONTINUE;
ELSE
LS_NUMBER=STRING(LI_NUMBER)
LS_SHXN+=LS_NUMBER+'/'
END IF
END FOR
MESSAGEBOX('',LS_SHXN)
然后建立一个 完整路径+水仙.TEXT,设立一个 [水仙花数]段,"水仙数字:"
用SETPROFILESTRING("水仙.TEXT","水仙花数","水仙数字",LS_SHXN)
程序应该是
integer i,a,b,c
for i=100 to 999
a=integer(i/100)
b=integer((i-100*a)/10)
c=i-integer(i/10)*10
if i=a*a*a+b*b*b+c*c*c then
messagebox("","i")
end if
next