八皇后问题如果用C++怎么去解决?

来源:百度知道 编辑:UC知道 时间:2024/06/13 11:39:16
it is the C++ but not the java

import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class dh5 extends Applet implements ActionListener
{
int r=100;
static Button b1=new Button("扩大");
static Button b2=new Button("缩小");
public void init()
{
add(b1);
add(b2);
b1.addActionListener(this);
b2.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
Button b=(Button)e.getSource();
if(b==b1)
r=r*2;
else
r=r/2;
Graphics g=getGraphics();
paint(g);
}
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawString("在WEB页面上画圆",100,20);
g.drawOval(150,150,r,r);
}
}