ParsX.com
پذیرش پروژه از دانشجویی ... تا سازمانی 09376225339
 
   ProfileProfile   Log in to check your private messagesLog in to check your private messages  |  FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups Log inLog in   RegisterRegister 

جواب تمرینات c
Goto page Previous  1, 2
 
Post new topic   Reply to topic    ParsX.com Forum Index -> C/C++ Programming
View previous topic :: View next topic  
Author Message
arash
مدير بخش سي
مدير بخش سي


Joined: 27 Nov 2004
Posts: 1232
Location: www.parsx.com

PostPosted: Tue Jan 18, 2005 12:23 am    Post subject: Reply with quote

تو چاکری من بیشتر !!!
اینم جواب یکی از سولهایی که ماله چند جلسه پیش بود .
مثال : پروسیجری بنویسید که یک رشته را به صورت معکوس در خروجی چاپ کند ؟ ( بازگشتی )
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int n;
void revers(char*);
main()
{
   char *ptr;
   clrscr();
   printf("\n\n\n  Enter n :");
   scanf("%d",&n);
   ptr=(char*)malloc(n*sizeof(char));
   printf("\n\n\n Enter string :");
   scanf("%s",ptr);
   *(ptr+n)=0;
   printf("\n\n\t");
   revers(ptr);
   getch();
   return 0;
}
/*****************************************************/
void revers(char *ptr)
{    if(n+1)printf("%c",*(ptr+n));
     if(n)
     {
      n--;
      return revers(ptr);
     }
}
Back to top
vahid
بي تو هرگز


Joined: 26 Nov 2004
Posts: 3067
Location: Tehran

PostPosted: Tue Jan 18, 2005 12:55 pm    Post subject: Reply with quote

و باز هم آرش ...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    ParsX.com Forum Index -> C/C++ Programming All times are GMT + 3.5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum