一个循环,每次给出2个字符串A,B,(各循环可能有重复)
要在循环结束的时候写出一个二维表:横坐标是A的种类,纵坐标是B的种类,
交点的值是A和B同时出现在循环里的次数的和。
这个表也是同时生成的。
有点蒙,望大家帮忙。

解决方案 »

  1.   

    //可能我的这个麻烦,但看在你这么着急,先这样吧,代码自己添加吧
    String A,B;
    String []a = new String[0];
    String []tempa= new String[0];
    String []b=  new String[0];
    String []tempb= new String[0];
    int [][]status = new int[0][0];
    int [][]tempstatus = new int[0][0];
    int i,j;for(你的循环条件)
    {
      A=...;
      B=...;
      //看看A在不在a中
      for(i=0;i<a.length;i++)
      {
       if(A.equals(a[i]))
       break;
      }
      if(i==a.length)
      {
       //把A添加到a中最后一个,可能要经过tempa中转一下值 (可用System.arraycopy)
       //status增加一列,把原来的数据考过去,新一列值都是0,可能也要用到tempstatus中转
      }
      //看看B在不在b中
      for(j=0;j<b.length;j++)
      {
       if(B.equals(b[j]))
       break;
      }
      if(j==j.length)
      {
       //把B添加到b中最后一个,可能要经过tempb中转一下值 (可用System.arraycopy)
       //status增加一行,把原来的数据考过去,新一行值都是0,可能也要用到tempstatus中转
      }
      status[i][i]+=1;
     
      
    }
    //最后输出