Sie sind auf Seite 1von 1

#include<stdio.

h>
#include<conio.h>
int pro();
int pro1();
char s[10];
int i=0,ib;
void main()
{
clrscr();
printf("enter input terminated by $:::" );
gets(s);
if(pro())
printf("input is accepted");
else
printf("input is not accepted");
getch();
}
int pro()
{
if(s[i]=='c')
{
i++;
if(pro1())
{
if(s[i]=='d')
{
i++;
if(s[i]=='$')
return(1);
}
}
}
return(0);
}
int pro1()
{
ib=i;
if(s[i]=='a')
{
i++;
if(s[i]=='b')
{
i++;
return(1);
}
}
i=ib;
if(s[i]=='a')
{
i++;
return(1);
}
return(0);
}

Das könnte Ihnen auch gefallen