cout<<"count1="<<count1<<endl;
应改为:
cout<<"count2="<<count2<<endl;

解决方案 »

  1.   

    for(int i=0;i<26;i++)
    {
      if (a[i]==4)
        count++;          //统计有几个4连在一起;
      else
      {
        if(count==2)
         count2++;         //统计2个4连在一起的有几个。在debuger时发现,最后一个4,4count=0;          //时这里总是被跳过;
      }
    }
     if(count == 1 && a[25] == 4)
        count2++;
     cout<<"count1="<<count1<<endl;    
      

  2.   

    for(int i=0;i<26;i++)
    {
      if (a[i]==4)
        count++;          //统计有几个4连在一起;
      else
      {
        if(count==2)
         count2++;         //统计2个4连在一起的有几个。在debuger时发现,最后一个4,4count=0;          //时这里总是被跳过;
      }
    }
     if(count == 1 && a[25] == 4)
        count2++;
     cout<<"count1="<<count2<<endl;
      

  3.   

    试一试:for(int i=0;i<=26;i++)
    {
    if(i!=26)
    if (a[i]==4)
    {
    count++;          //统计有几个4连在一起;
    contenue;
    }
    {if(count==2)
    count2++;         //统计2个4连在一起的有几个。在debuger时发现,最后一个4,4count=0;          //时这里总是被跳过;
    }
    }
      

  4.   

    #include<iostream.h>
    void main()
    {int a[26]={5,4,4,5,5,4,4,4,5,5,5,4,4,5,5,5,5,4,4,5,5,5,5,5,4,4 };
      
          
          int count2 = 0; int count=0;
    for(int i=0;i<26;i++)
    {if (a[i]==4)
    count++;          //统计有几个4连在一起;else
    {if(count==2)
    count2++;         //统计2个4连在一起的有几个。在debuger时发现,最后一个4,4count=0;          //时这里总是被跳过;
    }
    }     if(count==2)
       count2++;
    cout<<"count2="<<count2<<endl;} 
      

  5.   

    哈哈犯错误了。
    同意 itmask(vc&asp)
      

  6.   


    #include<iostream.h>
    void main()
    {
    int a[26]={5,4,4,5,5,4,4,4,5,5,5,4,4,5,5
    ,5,5,4,4,5,5,5,5,5,4,4 };
      
          
        int count2 = 0; int count=0;
    for(int i=0;i<26;i++)
    {
    if (a[i]==4)
    {
    count++;          //统计有几个4连在一起;

    if(count==2)
    count2++;         //统计2个4连在一起的有几个。在debuger时发现,最后一个4,4

    }
    else
    count=0;          //时这里总是被跳过;

    }      cout<<"count="<<count2<<endl;} 
    也不知道上面会不会串行。输出结果为5,不知道对不对
      

  7.   

    #include<iostream.h>
    void main()
    {
    int a[26]={5,4,4,5,5,4,4,4,5,5,5,4,4,5,5
    ,5,5,4,4,5,5,5,5,5,4,4 };
      
          
        int count2 = 0; int count=0;
    for(int i=0;i<26;i++)
    {
    while (a[i]==4 &&i<26)
    {
    count++; 
    i++;
    }

    if(count==2)

    count2++;         


    count=0;          

    }      cout<<"count="<<count2<<endl;} 
    这会的结果为4!!!!!
      

  8.   

    #include<iostream.h>
    void main()
    {
        int a[26]={5,4,4,5,5,4,4,4,5,5,5,4,4,5,5,5,5,4,4,5,5,5,5,5,4,4 };
        int count2 = 0; int count=0;
        for(int i=0;i<26;i++)
        {
            if (a[i]==4)
                count++;          //统计有几个4连在一起;
            else
                count = 0;        if(count==2)
            {
                count2++;         //统计2个4连在一起的有几个。
                count=0;
            }
        }         cout<<"count1="<<count2<<endl;

      

  9.   


    #include<iostream.h>
    void main()
    {
        int a[26]={5,4,4,5,5,4,4,4,5,5,5,4,4,5,5,5,5,4,4,5,5,5,5,5,4,4 };
        int count2 = 0; int count=0;
        for(int i=1;i<26;i++)
        {
            if (a[i]==4 && a[i-1]==4)
            {
                count2++;          //统计2个4连在一起的有几个。
                i++;
             }
        }         cout<<"count1="<<count2<<endl;