Advertisement
kimo12

Untitled

Apr 12th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. package SFG;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class sfg {
  6.  
  7. int[][] adjMatrix;
  8.  
  9. private void inputs(){
  10. Scanner scan = new Scanner(System.in);
  11. System.out.print("Enter The Number Of Nodes : ");
  12. int NumOfNodes = scan.nextInt();
  13. adjMatrix = new int[NumOfNodes][NumOfNodes];
  14. System.out.println("To Get Out From Entering Signal Flow Graph Representation");
  15. System.out.println("Put From = 0 ");
  16. while(true){
  17. int from,to,gain;
  18. System.out.print("From : ");
  19. from = scan.nextInt() - 1;
  20. if(from < 0){
  21. break;
  22. }
  23. System.out.print("To : ");
  24. to = scan.nextInt() - 1;
  25. System.out.print("gain : ");
  26. gain = scan.nextInt();
  27. adjMatrix[to][from] = gain;
  28. }
  29. }
  30.  
  31. public static void main(String[] args) {
  32. sfg g = new sfg();
  33. g.inputs();
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement