تم ولله الحمد أولا و أخرا وبمعا ونتك أخي password123
خصوصا وجميع اﻷخوة حل المشكلة وهذا كود كامل
#include<iostream>
#include <string.h>
using namespace std;
int SimpleMatching_d(string word1, string word2)
{
int count=0,max;
int Intersection=0;
//------------------maxmum----------------
if(word1.length()>word2.length())
max=word1.length();
else
max=word2.length();
//---------------------intersection------------
for(size_t i = 0; i < word1.length(); i+=2)
{
count=0;
for(size_t n = 0; n < word2.length(); n+=2)
{
if(word1.compare(i,2,word2,n,2) == 0)
count++;
}
if (count>0) //Intersection
Intersection++;
}
max=max/2;
return max-Intersection;
}وقد طبق معي بشكل صحيح و أعطى نتايج صحيحة ولله الحمد
تم تعديل هذه المشاركة بواسطة light stars في 26 مايو 2011 في 13:20