- package 绘制正玄函数;
- public class Main {
- public static void main(String[] args) {
- Double m = 0.1;/*表示精确读*/
- int n,x;
- for(Double y =1.0;y>=0;y-=m)
- {
- n = (int)(Math.asin(y)*10);
- for(x = 0;x<n;x++)
- System.out.print(" ");
- System.out.print("*");
- for(;x<31-n;x++)
- System.out.print(" ");
- System.out.println("*");
- }
- for(Double y =0.0;y>=-1;y-=m)
- {
- n = Math.abs((int)(Math.asin(y)*10));
- for(x = 0;x<=n+31;x++)
- System.out.print(" ");
- System.out.print("*");
- for(;x<62-n;x++)
- System.out.print(" ");
- System.out.println("*");
- }
- }
- }
输出样式:
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
**
- package 绘制余玄函数;
- public class Main {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Double m = 0.1;/*精确度*/
- int n,x;
- for(Double y = 1.0;y>=-1.0;y-=m)
- {
- n =Math.abs((int)(Math.acos(y)*10));
- for(x =0;x<n;x++)
- System.out.print(" ");
- System.out.print("*");
- for(;x<62-n;x++)
- System.out.print(" ");
- System.out.println("*");
- }
- }
- }
输出样式:
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
**