Comparison of the similarities and differences of Huawei machine test-elements

Source: Internet
Author: User

Enter two shaped arrays to find out the number of unequal positions in the two arrays.


    #include <iostream> using namespace std;          int diff_num (int arr1[],int len1,int arr2[],int len2) {int num=0;          int i=len1-1;          int j=len2-1;          int k= (LEN1&LT;LEN2)? Len1:len2;          k--;                  while (k>=0) {if (Arr1[i]!=arr2[j]) {num++;                  i--;                  j--;              k--;                  } else {i--;                  j--;              k--;      }} return num;          } int main () {int arr1[100];          int arr2[100];                int a,k=0,b,l=0;          cin>>a;              while (GetChar ()! = ' \ n ') {arr1[k++]=a;          cin>>a;                } arr1[k++]=a;          cin>>b;              while (GetChar ()! = ' \ n ') {arr2[l++]=b;          cin>>b;       }   Arr2[l++]=b;          Cout<<diff_num (arr1,k,arr2,l) <<endl;      return 0;   }


Comparison of the similarities and differences of Huawei machine test-elements

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.