Professional Documents
Culture Documents
THEORY:-
CODE:
#include <bits/stdc++.h>
{
{
cout<<"S->"<<a;
return;
}
{
if(a[i]=='*')
{
if(i==a.length())
{
cout<<"S'->"<<a[i-1]<<"S'|^";
}
else
{
cout<<"S'->"<<a[i-1]<<"S'|^";
}
}
if(a[i]=='+')
{
if(i==a.length()-1)
{
cout<<"S ->"<<a.substr(0, i-1)<<"S'"<<endl;
cout<<"S'->"<<a[i-1]<<"S'|"<<a[i-1];
}
else
{
}
}
}
}
int main()
{
{
cin>>a;
cfg(a);
cout<<endl;
}
}
OUTPUT;
RESULT:
The program is successfully written and created in the c language