您好,欢迎来到暴趣科技网。
搜索
您的当前位置:首页java伪代码_JAVA 伪代码

java伪代码_JAVA 伪代码

来源:暴趣科技网

帮忙把下面的JAVA代码用伪代码的形式写出来importjava.util.Scanner;importjava.util.Random;importjava.util.Random;publicclasschen{publicstaticvoidmain(String[]args){intVertic...

帮忙把下面的JAVA代码用伪代码的形式写出来

import java.util.Scanner;

import java.util.Random;

import java.util.Random;

public class chen

{

public static void main(String[] args)

{

int Vertices;

Random x = new Random();

System.out.println("Pleas enter the number of vertices which should be larger than 2 and less than 11\n");

Scanner sc=new Scanner(System.in);

Vertices = sc.nextInt();

if(Vertices<3||Vertices>11)

{

System.out.printf("The number you have entered is out of reign, please enter the vertices number again\n");

System.exit(0);

}

int[][] Graph= new int[Vertices][Vertices];

Random r=new Random();

for(int i=0; i

for(int j=0;j

{

if(i==j)

Graph[i][j]=0;

else

Graph[i][j]=r.nextInt(10)+1;

}

}

for(int i=0;i

for(int j=0;j

Graph[i][j]=Graph[j][i];

}

}

for(int i=0;i

for(int j=0;j

System.out.print(Graph[i][j]+" ");

}

System.out.println();

}

}

展开

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- baoquwan.com 版权所有 湘ICP备2024080961号-7

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务