java爱心
把如下代码加入<body>区域中
<style type="text/css">
body
{
background-color:#FFFFFF;
font-family: Arial;
font-size:10pt;
}
</style>
<script>
text=new Array('www','njcatv','net','需要放大的
/\/\
\ /
\/
文字')
var numText=4
color=new Array('#000000','#2F2F2F','#4F4F4F','#7F7F7F','#408080')
var numColors=5
var endSize=70
var Zspeed=30
var Cspeed=200
var font='Arial Black'
var hide=false
var size=10
var gonum=0
var ie, n;
if (document.all) {
n=0
ie=1
zoomText='document.all.zoom.innerText=text[num]'
zoomSize='document.all.zoom.style.fontSize=size'
closeIt=""
fadeColor="document.all.zoom.style.color=color[num]"
}
if (document.layers) {
n=1;ie=0
zoomText=""
zoomSize="document.zoom.document.write('<p align=\"center\" style=\"font-family:'+font+'; font-size:'+size+'px; color:'+color[0]+'\">'+text[num]+'</p>')"
closeIt="document.zoom.document.close()"
fadeColor="document.zoom.document.write('<p align=\"center\" style=\"font-family:'+font+'; font-size:'+endSize+'px; color:'+color[num]+'\">'+text[numText-1]+'</p>')"
}
function zoom(num,fn){
if (size<endSize){
eval(zoomText)
eval(zoomSize)
eval(closeIt)
size+=5;
setTimeout("zoom("+num+",'"+fn+"')",Zspeed)
}else{
eval(fn);
}
}
function fadeIt(num){
if (num<numColors){
eval(fadeColor)
eval(closeIt)
num+=1;
setTimeout("fadeIt("+num+")",Cspeed)
}else{
hideIt()
}
}
function hideIt(){
if(hide){
if(ie)document.all.zoom.style.visibility="hidden"
if(n)document.layers.zoom.visibility="hidden"
}
}
function init(){
if(ie){
document.all.zoom.style.color=color[0]
document.all.zoom.style.fontFamily=font
}
if(ie || n) go(0)
}
function go(num){
gonum+=1
size=10
if(num<numText){
zoom(num,'go('+gonum+')')
}else{
fadeIt(0)
}
}
</script>
<div id="zoom" align="center" style="position:absolute; top:150">
『贰』 java 用*画个心形
要实心的还是空心的,如果是实心的用循环嵌套,列循环中嵌套行的循环就可以了
『叁』 怎么用java编写一个爱心
分析:
首先爱心分成两半前面三行左右一样右边就可以通过左边反相得到
中间两行是个长方形,剩下的就是个倒等腰三角形
2.在或者,长得不太像- -
System.out.println(" ** **");
for (int i = 4; i < 10; i++) {
for (int a = 0; a < i; a++) {
System.out.print(" ");
}
for (int b = 1; b <= 2 * 9 - 2 * i - 1; b++) {
System.out.print("*");
}
System.out.print(" ");
}
** **
*********
*******
*****
***
*
『肆』 java 绘制图形——爱心。
想泡妞还不想下功夫,这个坚决不能告诉你 。。
『伍』 如何用java中的for输出心形
public class Test{
static float count(float x, float y) {
(float) (Math.pow((x * x + y * y - 1), 3) - x * x * y * y * y);
}
public static void printEmpty() {
int height = 50, width = 100;
int heart[][] = new int[height][width];
float hx = 0.0f, hy = 0.0f;
for (int y = height / 2; y > -height / 2; y--) {
for (int x = -width / 2; x < width / 2; x++) {
hx = (float) x / (float) (width / 2.8f);
hy = (float) (y) / (float) (height / 2.8f);
if (count(hx, hy) <= 0.0f) {
heart[height / 2 - y][x + width / 2] = 1;
}
}
}
for (int y = 1; y < height - 1; y++) {
for (int x = 1; x < width - 1; x++) {
if (heart[y][x] == 1
&& !(heart[y][x - 2] == 1 && heart[y][x + 2] == 1
&& heart[y - 1][x] == 1 && heart[y + 1][x] == 1)) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
System.out.println();
}
System.out.println();
}
public static void main(String[] args) {
printEmpty();
}
}
『陆』 如何用java画出心形
最简单的system.out.print();
自己多打印几次试试就好了
『柒』 for语句 输出心形(java)
for语句输出心形(java)的方法如下:
使用eclipse,创建一个Java文件命名为Test.java
(7)java爱心扩展阅读:
for 语句表达式:
表达式1:一般为赋值表达式,给控制变量赋初值;
表达式2:关系表达式或逻辑表达式,循环控制条件;
表达式3:一般为赋值表达式,给控制变量增量或减量。
『捌』 Java 心形图形
public class Heart {
public static void main(String[] args) {
int size = 4;
int number = 7;
for (int i = 0; i <= size; i++) {
for (int j = 4; j <= 4 - i; j--)//变量j一直自减 最后是负数的时候也满足条件 所以无限循环了
System.out.print(" ");
for (int j = 1; j <= i; j++)//
System.out.print("*");
for (int j = size; j <= size - i; j--)//变量j一直自减1 最后是负数的时候也满足条件 所以无限循环了
System.out.print(" ");
for (int j = 1; j <= i; j++)
System.out.print("*");
System.out.println();
}
for (int k = number; k <= number; k--) {
System.out.print("*");
System.out.println();
}
}
}
『玖』 java如何画出爱心
这个成不
1.首先获取爱心的数学表达式(函数);
2.然后Bitmap bit=new Bitmap(32,32);Graphics g=Graphics.FromImage(bit);
3.确定一个开始点startPoint,根据函数递归所有点,画出爱心。
『拾』 如何用java在页面上用循环打印一个爱心形状
||import java.util.Scanner;
public class test{
static void draw(int n)
{
int i,j;
for (i=1-(n>>1);i<=n;i++)
if (i>0)
{
for (j=0;j<i;j++) System.out.print(" ");
for (j=1;j<=2*(n-i)+1;j++)
if (j==1||j==2*(n-i)+1) System.out.print(" *");
else System.out.print(" ");
System.out.println("\n");
}
else
if (i==0)
{
System.out.print(" *");
for (j=1;j<n;j++) System.out.print(" ");
System.out.print(" *");
for (j=1;j<n;j++) System.out.print(" ");
System.out.print(" *\n");
}
else
{
for (j=i;j<0;j++) System.out.print(" ");
for (j=1;j<=n+2*i+1;j++)
if (i==1-(n>>1)) System.out.print(" *");
else if (j==1||j==n+2*i+1) System.out.print(" *");
else System.out.print(" ");
for (j=1;j<=-1-2*i;j++) System.out.print(" ");
for (j=1;j<=n+2*i+1;j++)
if (i==1-(n>>1)) System.out.print(" *");
else if (j==1||j==n+2*i+1) System.out.print(" *");
else System.out.print(" ");
System.out.print("\n");
}
}
public static void main(String[] args) {
System.out.println("Please input the size (n>=4):");
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
draw(n);
}
}先说明这个不是我写的 是看了有人用C语言写的 就顺便改成了java 结果有点像爱心 还凑合着 你看看怎么样吧 哈