
المشاركة الأصلية كتبت بواسطة خزامى نجد
اهلين اخوي انا عندي برنامج بسيط ابغى الحل بأسرع وقت .. اكتب برنامج بلغة ++c يقرأ كلمتين ثم يطبع الحروف المشتركه بين الكلمتين.. الف شكر..
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main(void)
{
char arr1[10];//first string
char arr2[10];//second string
char arr3[10];//the simmilar letters string
int i,j,w=0;//counters
cout<<"please enter first string: ";
cin>>arr1;
cout<<"please enter second string: ";
cin>>arr2;
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
if((arr1[i]==arr2[j])&&!strchr(arr3,arr1[i]))//check the similarity, just 4 once
arr3[w++]=arr1[i];//put n arr3
}
}
cout<<"these are the simmilar charcters between the two strings: "<<arr3;
getch();
}