
CODE: [Copy to clipboard]改写的VBS代码是:#include "stdio.h"
main()
{int x,i,n=0;
clrscr();
for(x=100;x<=999;x++)
{for(i=2;i<x;i++)
if(x%i==0) break;
if(i>=x)
{printf("%d ",x);
n++;
if(n%10==0) printf("\n");
}
}
}
CODE: [Copy to clipboard]这个VBS代码输出的结果是s变量值空的,我检查了很长的时间也没发现语法上有什么问题。Dim x,i,s
s = ""
For x = 100 To 999
For i = 2 To x
If(x mod i = 0) Then Exit For
If(i >= x) Then
s = s & x & " "
End If
Next
Next
Msgbox(s)
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |