س/اكتب برنامج بلغه ++c مستخدما الاستدعاء الذاتي (recursion) لطباعه سلسله حرفيه (string) ???
مثل:
input: the bird went of cage الادخال
out put: the bird went of cage الاخراج
ومحاولتي كانت كالاتي الا اني ما نجحت في تخطي مترجم ++c في التنفيذ Run
#include<iostream.h>
#include<string.h>
const int size=10;
void print(char s[size],int l)
{l=strlen(s);
int z=l-1;
if(z>=0)
s[l]='\0'; // end of string
else
{int a=0;
print(s,l-1);
char temp=s[a];
s[a]=s[z];
s[z]=temp;
a++;
z--;
cout<<s[l];
}
}
void main()
{char s[size];int l;
cout<<"enter string:"<<endl;
cin>>s;
print(s,l);}وشكرا لكل من يساهم ولو بفكره معينه كل الشكر والتقدير الى جميع الاعضاء في المنتدى ..........