/* Assignment
Ex8.c */
// Program omitting the bracket subsequence
void main()
{
int i,k=0,len=0,j=0;
char str[31],a[31],d;
clrscr();
//Enter a string
printf("\n\n Enter a string: ");
gets(str);
flushall();
for(;str[len]!='\0';len++) //Measure String Length
/* Convert opening braces'(' & all other characters
in bracket in ')'*/
for(i=0;str[i]!='\0';i++)
{
j=i;
while(str[j]=='(')
{
for(; str[j]!=')'; j++)
{
str[j]=')';
}
}
}
//Delete ')' character and move characters to left
for(i=0;i<=len;i++)
{
if(str[i]!=')')
{
a[k++]=str[i];
}
}
//Output
printf("\n\n The manipulated string: %s",a);
printf("\n\n\n Press any key to exit...");
getch();
}
Ex8.c */
// Program omitting the bracket subsequence
void main()
{
int i,k=0,len=0,j=0;
char str[31],a[31],d;
clrscr();
//Enter a string
printf("\n\n Enter a string: ");
gets(str);
flushall();
for(;str[len]!='\0';len++) //Measure String Length
/* Convert opening braces'(' & all other characters
in bracket in ')'*/
for(i=0;str[i]!='\0';i++)
{
j=i;
while(str[j]=='(')
{
for(; str[j]!=')'; j++)
{
str[j]=')';
}
}
}
//Delete ')' character and move characters to left
for(i=0;i<=len;i++)
{
if(str[i]!=')')
{
a[k++]=str[i];
}
}
//Output
printf("\n\n The manipulated string: %s",a);
printf("\n\n\n Press any key to exit...");
getch();
}

0 comments:
Post a Comment