import javax.swing.JOptionPane;
public class yu
{
public static void main(String srgs[])
{
String output="";
double m=1;
int x=1,y=1;
for(y=10;y<=-10;y--)
{
m=2.5*Math.sqrt(100-y*y);
for(x=1;x<=30-m;x++)
{
output+=" ";
}
output+="*";
for(;x<=30+m;x++)
{
output+=" ";
}
output+="*";
}
JOptionPane.showMessageDialog(null,output,"test",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
*****************************************************************************************
上面的程序为什么执行后没一点显示?谢谢!
public class yu
{
public static void main(String srgs[])
{
String output="";
double m=1;
int x=1,y=1;
for(y=10;y<=-10;y--)
{
m=2.5*Math.sqrt(100-y*y);
for(x=1;x<=30-m;x++)
{
output+=" ";
}
output+="*";
for(;x<=30+m;x++)
{
output+=" ";
}
output+="*";
}
JOptionPane.showMessageDialog(null,output,"test",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
*****************************************************************************************
上面的程序为什么执行后没一点显示?谢谢!
没有进循环啊!!!!
public class yu
{
public static void main(String srgs[])
{
String output="";
for(int i=0;i<10;i++){
output+="a";
}
//System.out.println(output);
JOptionPane.showMessageDialog(null,output,"test",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
import javax.swing.JOptionPane;public class yu {
public static void main(String srgs[]) {
String output = "";
double m = 1;
int x = 1, y = 1;
for (y = 10; y >= -10; y--) {
m = 2.5 * Math.sqrt(100 - y * y);
m = 1;
for (x = 1; x <= 30 - m; x++) {
output += " ";
}
output += "*";
for (; x <= 30 + m; x++) {
output += " ";
}
output += "*";
}
JOptionPane.showMessageDialog(null, output, "test",
JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
import javax.swing.JOptionPane;
public class yu
{
public static void main(String srgs[])
{
String output="";
double m=1;
int x=1,y=1;
for(y=10;y >=-10;y--)
{
m=2.5*Math.sqrt(100-y*y);
for(x=1;x <=30-m;x++)
{
output+=" ";
}
output+="*";
for(;x <=30+m;x++)
{
output+=" ";
}
output+="*";
}
JOptionPane.showMessageDialog(null,output,"test",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
主要是循环的条件不能满足,还有一个就是public static void main(String args[])
***************String output="";
double m=1,y=1;
int x=1;
*******************************************************************************这是一个输出圆的代码,很初级的。谢谢了,关键是本人太菜了!