#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char string[50];
int flag,count=o;
clrscr();
printf("The grammar is: S->aS, S->Sb, S->ab\n");
printf("Enter the string to be checked:\n");
gets(string);
if(string[0]=='a')
{
flag=0;
for(count=1;string[count-1]!='\0';count++)
{
if(string[count=='b'])
{
flag=1;
continue;
}
else if((flag==1)&&(string[count]=='a'))
{
printf("The string does not belong to the specified grammar");
break;
}
else if(string[count=='a'])
continue;
else if(flag==1)&&(string[count]='\0'))
{
printf("The string accepted");
break;
}
else
{
printf("String not accepted");
}
getch():
.... String line = "This is example program with spaces"; String[] tokens = line.split(" "); System.out.println(tokens.length-1); .......
/*To check whether a string is palindrome*/includeincludevoid main () { int i,j,f=0; char a[10]; clrscr (); gets(a); for (i=0;a[i]!='\0';i++) { } i--; for (j=0;a[j]!='\0';j++,i--) { if (a[i]!=a[j]) f=1; } if (f==0) printf("string is palindrome"); else printf("string is not palindrome"); getch (); }
a promlem to solve an equation or a assigment
That's easy to do!This script will get the POST data from an HTML form and check if it is a vowel.
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
8086 assembly language program to check wether given number is perfect or not
Check the documentation of the String class, for a method that searches for a substring.
.... String line = "This is example program with spaces"; String[] tokens = line.split(" "); System.out.println(tokens.length-1); .......
/*To check whether a string is palindrome*/includeincludevoid main () { int i,j,f=0; char a[10]; clrscr (); gets(a); for (i=0;a[i]!='\0';i++) { } i--; for (j=0;a[j]!='\0';j++,i--) { if (a[i]!=a[j]) f=1; } if (f==0) printf("string is palindrome"); else printf("string is not palindrome"); getch (); }
No.
a promlem to solve an equation or a assigment
That's easy to do!This script will get the POST data from an HTML form and check if it is a vowel.
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
The parse tree for the given string would show the structure of the string broken down into tokens and their relationships based on the grammar rules. In this case, based on the example provided, the parse tree would illustrate how the string 'AA AA a b' can be derived from the grammar rules defined for the language.
You usually do not need to delete a String, since when the program no longer refers to it, the garbage collector will clean it up.
This functionality is already in Java. String.toLowerCase() and String.toUpperCase() will take care of it for you.
You find a language that can be targeted towards the .NET Framework. What you are suggesting is something related to string manipulation and you can work with delimiters.