Displaying Source Code(s)
|
|
Program to Identify Tokens In A Given Line viz. Identifier,
Literal, Alphabet, Special Symbol(_,-) e
--------------------------------------------------------------------------------
Description : This program is used to identify the tokens in a
given string.
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#define COLOR1 {textcolor(6); textbackground(1);}
#define COLOR2 {textcolor(5); textbackground(15);}
#define COLOR3 textcolor(6);
#define COLOR4 textcolor(9);
void main()
{
char book[100];
char grid[10][30];
int k = 0;
int row = 0;
int col = 0;
int i = 0;
int clock = 0;
int j = 0;
int shiva = 0;
clrscr();
cout<<"Enter a string : ";
gets(book);
k = strlen(book);
book[k] = 32;
book[k+1] = '#';
for(i=0;book[i]!='#';i++)
{
while(book[i]!=32)
{
grid[row][col] = book[i];
col++;
i++;
}
grid[row][col++] = ' |
|
|