answersLogoWhite

0

#include

#include

#include

void keyw(char str[10])

{

if(strcmp("for",str)==0)

printf("%s is a keyword",str);

else if(strcmp("while",str)==0)

printf("%s is a keyword",str);

else if(strcmp("char",str)==0)

printf("%s is a keyword",str);

else if(strcmp("int",str)==0)

printf("%s is a keyword",str);

else if(strcmp("if",str)==0)

printf("%s is a keyword",str);

else if(strcmp("else",str)==0)

printf("%s is a keyword",str);

else

printf("%s is an identifier",str);

printf("\n");

}

main()

{

FILE *f1,*f2,*f3;

char c,str[10];

int num[100],ln=0,tvalue=0,i=0,j=0,k=0;

printf("Enter a C program expression");

f1=fopen("input.c","w");

while((c=getchar())!=EOF)

fputc(c,f1);

f1=fopen("input.c","r");

f2=fopen("identifier.txt","w");

f3=fopen("specialchars.txt","w");

while((c=fgetc(f1))!=EOF)

{

if(isdigit(c))

{

tvalue=c-'0';

c=fgetc(f1);

while(isdigit(c))

{

tvalue=tvalue*10+c-'0';

c=fgetc(f1);

}

num[i++]=tvalue;

ungetc(c,f1);

}

else if(isalpha(c))

{

fputc(c,f2);

c=fgetc(f1);

while((isdigit(c))isalpha(c)c==' 'c=='$')

{

fputc(c,f2);

c=fgetc(f1);

}

fputc(' ',f2);

ungetc(c,f1);

}

else if(c==' 'c=='\t');

else if(c=='\n')

ln++;

else

fputc(c,f3);

}

fclose(f1);

fclose(f2);

fclose(f3);

printf("Numbers in the program are \n");

for(j=0;j

printf("%d",num[j]);

printf("\n");

f2=fopen("identifier.txt","r");

k=0;

while((c=fgetc(f2))!=EOF)

{

if(c!=' ')

str[k++]=c;

else

{

str[k]='\0';

keyw(str);

k=0;

}

}

fclose(f2);

f3=fopen("specialchars.txt","r");

printf("The special chars in the pgm are \n");

while((c=fgetc(f3))!=EOF)

printf("%c",c);

printf("\n");

fclose(f3);

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

Can you identify the d-block element in the periodic table?

The d-block elements in the periodic table are located in groups 3 to 12. They are transition metals that have partially filled d orbitals.


How many transition elements are there in the periodic table?

There are 38 transition elements in the periodic table.


Where are transition metals located on the periodic table?

The transition metals are located in groups 3 - 12 on the Periodic Table.


Is francium a transition metal?

No, francium is not a transition metal. It belongs to the alkali metal group on the periodic table. Transition metals are found in the d-block of the periodic table.


Where placed keywords in c?

Inside the symbol table of the compiler.


Is sodium a transition metal?

Sodium is an alkali metal, group 1 in the periodic table of Mendeleev (not a transition metal !).NO!


How many elements are classified as transition metals in the periodic table?

There are 38 elements classified as transition metals in the periodic table.


Is lithium a transition element?

No, the Transition Metals are found in Groups III B to II B in the periodic table.


How many elements are in transition metals?

transition metals are not in any groups, however they are elements between group II & III of the periodic table


Where are the transition meatls on the perdioc table?

in the middle


Is chlorine a transition metal?

No, chlorine is not a transition metal. It is a nonmetal element in the halogen group of the periodic table. Transition metals are found in the d-block of the periodic table.


Which is the most unstable species in periodic table among transition and inner transition element?

The most unstable species in the periodic table among transition and inner transition elements is #43 Technetium (Tc). It is so unstable that it does not occur naturally.

Trending Questions
In a pinch a pile of bricks or water pipes can be used in place of jack stands when using hydraulic jacks true or false? Binary adder-subtractor combine circuit? What is the correct CSS for adding a background image to a page? A PNP transistor is connected in a circuit so that the collector-base junction remains reverse biased and the emitter-base junction is forward biased This transistor can be used as a power amplifi? What is the current value of a Remington model 78 sportsman 30.06 in 85 condition? What are the 3 most effcient machines? What is a start and end symbol in a flowchart? What quantity of the voltmeter? You installed half inch pex through whole house and you have no pressure how do you fix this? What would most likely happen next if a jetty was built on a beach? What is the meaning of real electrical power (p) reactive power (Q) and apparent power (S)? How do you write a program to scan a number n and then output the sum of the powers from 1 to n using for loop statement? How long does hydraulic oil injection take to kill you? What is the cost of a nuclear reactor? Do you need a shunt trip in the elevator disconnect switch if you do not have a sprinkler head in the elevator? When did N. C. Vasanthakokilam die? Why is the frequency of operation in Nigeria 50Hz but it differs elsewhere? What is a useful feature of a building or place? Why instrumentation amplifier is a good differential amplifier? Which is the 2nd most developed district in karnataka?