Advertisement
kimo12

Untitled

Apr 12th, 2017
84
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. private void inputs(){
  8. Scanner scan = new Scanner(System.in);
  9. System.out.println("Enter The Number Of Nodes : ");
  10. int NumOfNodes = scan.nextInt();
  11. int[][] adjMatrix = new int[NumOfNodes][NumOfNodes];
  12. System.out.println("To Get Out From Entering Signal Flow Graph Representation");
  13. System.out.println("Put From = 0 ");
  14. while(true){
  15. int from,to,gain;
  16. System.out.println("From : ");
  17. from = scan.nextInt() - 1;
  18. if(from < 0){
  19. break;
  20. }
  21. System.out.println("To : ");
  22. to = scan.nextInt() - 1;
  23. System.out.println("gain : ");
  24. gain = scan.nextInt();
  25. adjMatrix[to][from] = gain;
  26. }
  27. }
  28.  
  29. public static void main(String[] args) {
  30. sfg g = new sfg();
  31. g.inputs();
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement