#include <iostream>
#include <string>
using namespace std;
string Pi="it in present indefinite tense",Pc="it in present continuous tense",Pp="it in present perfect tense",Ppc="its in present perfect continuous tence",Pai="its in past indefinite tense",Pac="its in past continuous tense",Pap="its in past perfect tense",Papc="it in past perfect continuous tense",Fi="its in future indefinite tense",Fc="its in future continuous tense",Fp="its in future perfect tense",Fpc="its in future perfect continuous tense";
string PITense(string a)
{
string PIArray[2]={"do","does"};
if(a.find(PIArray[0])!=string::npos) {
return Pi;
}
else {
if(a.find(PIArray[1])!=string::npos)
{
return Pi;
}
}
}
string PCTense(string a) {
string PCArray[3]={"is","am","are"};
if(a.find(PCArray[0])!=string::npos) {
return Pc;
}
else {
if(a.find(PCArray[1])!=string::npos) {
return Pc;
}
else {
if(a.find(PCArray[2])!=string::npos) {
return Pc;
}
}
}
}
string PPTense(string a) {
string PPArray[2]={"has","have"};
if(a.find(PPArray[0])!=string::npos) {
return Pp;
}
else {
if(a.find(PPArray[1])!=string::npos) {
return Pp;
}
}
}
string PPCTense(string a) {
string PPCArray[2]={"has been","have been"};
if(a.find(PPCArray[0])!=string::npos) {
return Ppc;
}
else {
if(a.find(PPCArray[1])!=string::npos) {
return Ppc;
}
}
}
string PaITense(string a) {
string PaITense[1]={"did"};
if(a.find(PaITense[1])!=string::npos) {
return Pai;
}
else if(a.find(PaITense[1])==string::npos) {
return Pai;
}
}
string PACTense(string a) {
string PACTense[2]={"was","were"};
if(a.find(PACTense[0])!=string::npos) {
return Pac;
}
else {
if(a.find(PACTense[1])!=string::npos) {
return Pac;
}
}
}
string PaPTense(string a) {
string PAPTense[1]={"had"};
if(a.find(PAPTense[0])!=string::npos) {
return Pap;
}
}
string PaPCTense(string a) {
string PAPCTense[1]={"had been"};
if(a.find(PAPCTense[0])!=string::npos) {
return Papc
}
}
string FiTense(string a) {
string FITense[2]={"shall","will"};
if(a.find(FITense[0])!=string::npos) {
returm Fi;
}
else {
if(a.find(FITense[1])!=string::npos) {
return Fi;
}
}
}
string FcTense(string a) {
string FCTense[2]={"shall be","will be"};
if(a.find(FCTense[0])!=string::npos) {
return Fc;
}
else {
if(a.find(FCTense[1])!=string::npos) {
return Fc;
}
}
}
string FpTense(string a) {
string FPTense[2]={"will have","shall have"};
if(a.find(FPTense[0])!=string::npos) {
return Fp;
}
else {
if(a.find(FPTense[1])!=string::npos) {
return Fp;
}
}
}
string FpcTense(string a) {
string FPCTense[2]={"will have been","shall have been"};
if(a.find(FPCTense[0])!=string::npos) {
return Fpc;
}
else {
if(a.find(FPCTense[1])!=string::npos) {
return Fpc;
}
}
}
string AcProgram() {
string c;
getline (cin,c);
if(c.find("do"||"does")!=string::npos) {
return PITense(c);
}
else {
if(c.find("is"||"am"||"are")!=string::npos) {
return PCTense(c);
}
else{if(c.find(" has "||" have ")!=string::npos)
{
return PPTense(c);
}
else {
if(c.find("has been"||"have been")!=string::npos) {
return PPCTense(c);
}
else {
if(c.find("did")!=string::npos) {
return PaITense(c);
}
else {
if(c.find("was"||"were")!=string::npos) {
return PACTense(c);
}
else {
if(c.find(" had ")!=string::npos) {
return PaPTense(c);
}
else {
if(c.find("had been")!=string::npos) {
return PaPCTense(c);
}
else {
if(c.find(" shall "||" will ")!=string::npos) {
return FiTense(c);
}
else {
if(c.find("shall be"||"will be")!=string::npos) {
return FcTense(c);
}
else {
if(c.find("shall have"||"will have")!=string::npos){
return FpTense(c);
}
else {
if(c.find("will have been"||"shall have been")) {
return FpcTense(c);
}
}
}
}
}
}
}
}
}
}
}
}
}
int main() {
cout<<"WELCOME TO TENSE.TELLER"<<endl;
cout<<"THIS PROGRAM WILL TELL YOU WHAT TENSE IS THE SENTENCE THAT YOU TYPE AND ENTER IS WRITTEN IN."<<endl;
cout<<"PLEASE ENTER YOUR SENTENCE: "<<endl;
cout<<AcProgram();
}
hi guys this is my program which tells the tense of the sentence the user inputs.but when ever i test it ,it prints something weird which is neither in English nor in numbers.Sample input is:
I am a boy.
from this the output should be that the program prints on the screen"its in present indefinite"(without the quotes).

New Topic/Question
This topic is locked



MultiQuote




|