java矢量的笛卡尔积

时间:2017-11-01 07:49:12

标签: java vector cartesian-product

我想制作从键盘插入的2个向量的笛卡尔积:

    import java.util.Scanner;
    import java.util.Vector;
    import java.util.Enumeration;

    class Vectors {
    Scanner mihai = new Scanner (System.in);
    int a, b;
    Vector A = new Vector();
    Vector B = new Vector();
    System.out.println("How many elements does the vector A have?");
    a = mihai.nextInt();
    System.out.println("Enter the elements of vector a A?");
    for(int an = 0; an < a;an++) {
        A.addElement(mihai.nextInt());
    }
    System.out.println("How many elements does the vector B have?");
    b = mihai.nextInt();
    System.out.println("Enter the elements of vector a B?");
    for(int bn = 0;bn < b;bn++) {
        B.addElement(mihai.nextInt());
    }

    Enumeration AEnum = A.elements();
    Enumeration BEnum = B.elements();


    }

    }

如果你知道请写。我需要用不带数组的向量来创建这个程序。

(更多细节,更多细节,更多细节,更多细节)

0 个答案:

没有答案