Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 13.58.200.78
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/relott/../ndlutz/CS311/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/relott/../ndlutz/CS311/wff.cpp
// Nathan Lutz
// Dr. Ames 
// 10-30-08
// Program disc.: Wff catcher. This program is designed to catch certain combinations of characters recursively. 

#include<iostream>

using namespace std;

bool WffCatcher()							// Best way to test things is with a bool
{
    char x;
    cin.get(x);
    if ( x == 'N')							// N case
    {   
	if ( WffCatcher() )						
	    return true;
	else
	     return false;
    }
    else if ( x == 'C' || x == 'A' || x == 'K' || x == 'E') 		// C, A, K, E case
    {
	if ( WffCatcher() )
	{
	     if ( WffCatcher() )
		  return true;
	     else
		  return false;
	}
	else
	     return false;
    }
    else if ( x == 'p' || x == 'q' || x == 'r' || x == 's')		// p,q,r,s case
	return true; 
    else								// Catch-all
    	return false;
}

int main ()
{
    char t;
    cout<<"Enter a string of characters to see if they are WFF"<<endl;
    if( WffCatcher() )
    {
	cin.get(t);
	if( t == '\n' )
	     cout<<"This is a WFF"<<endl;
	else
	     cout<<"This is not a WFF"<<endl;
    }
    else
	cout<<"This is not a WFF"<<endl;
    return 0;
}
 

Stv3n404 - 2023