How to write program Grammar Checker in C++ Source Code

Write source code programming for Grammar checker.
This project “Natural Language Based on Grammar Checker” was developed mainly for checking the grammar error. It is an automated tool which checks the grammatical error from the given text. Our intent is to create a natural language based on grammar checker to check the ambiguities in the given sentence. We are using three functions each independent from each other.This function will get the input from the user and check the verb for tense and display the tense whether it is present tense or past tense or future tense.
Source code program in C++ Software Engineering
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<graphics.h>
#include<process.h>
#include<dos.h>
int j=0,s1,s2,k,i,f;
int gdriver = EGA,gmode = DETECT;
char t[10][10] = {'\0'},tp,al,cha={'\0'};
void choice();
void text();
void present();
void past();
void future();
void background();
void main()
{
clrscr();
choice();
getch();
}
void background()
{
clrscr();
initgraph(&gdriver,&gmode,"");
setbkcolor(15);
}
void choice()
{
int n;
clrscr();
gotoxy(30,8);
cout<<"1:Present";
gotoxy(30,11);
cout<<"2:Past";
gotoxy(30,14);
cout<<"3:Future";
gotoxy(30,17);
cout<<"4:Exit";
n=getch();
switch(n)
{
case '1':
clrscr();
text();
present();
break;
case '2':
clrscr();
text();
past();
break;
case '3':
clrscr();
text();
future();
break;
case '4':
exit(0);
default:
cout<<"WRONG INPUT";
choice();
}
}
void present()
{
int c;
char pr[5][5]={"is","are","have","has","am"};
f=1;
for(k=0;k<5;k++)
{
c=strcmpi(t[1],pr[k]);
if(c==0)
f=0;
}
if(f==0)
cout<<"\nIt is a Present Tense\n";
else
cout<<"\n Wrong\n";
al=getch();
if(al=='\r')
choice();
}
void past()
{
char d[3]={'\0'},d1[3]={"ed"};
char pa[10][5]={"was","went","were","had","ate","did"};
int c1,c2=1;
f=1;
for(int kl=0;kl<10;kl++)
{
if(t[1][kl]=='\0')
break;
}
if(t[1][kl]=='\0')
{
d[0]=t[1][kl-2];
d[1]=t[1][kl-1];
}
c2=strcmpi(d,d1);
if(c2==0)
cout<<"\nIt is a past sentence\n";
else
{
for(k=0;k<6;k++)
{
c1=strcmpi(t[1],pa[k]);
if(c1==0)
f=0;
}
if(f==0)
cout<<"\nIt is a past tense\n ";
else
cout<<"\nWrong\n";
}
al=getch();
if(al=='\r')
choice();
else
choice();
}
void future()
{
char fu[5][7]={"will","shall","would","should"};
int c2;
f=1;
for(k=0;k<5;k++)
{
c2=strcmpi(t[1],fu[k]);
if(c2==0)
f=0;
}
if(f==0)
cout<<"\nIt is future Sentence\n";
else
cout<<"\nWrong\n";
al=getch();
if(al=='\r')
choice();
else
choice();
}
void text()
{
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
t[i][j]=cha;
}
}
cout<<"\n Enter the Text:\n";
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
tp=getche();
if(tp==' ')
goto s1;
if(tp=='\r')
{
goto s2;
}
t[i][j]=tp;
}
s2:
break;
s1:
}
for(int il=0;il<=i;il++)
{
cout<<t[il]<<" ";
}
}Grammar checker program Output Screenshot in C.
how to write source in c programming for present past tense checker

Related post