Site hosted by Angelfire.com: Build your free website today!
Master Menu - Links the Master Page


Columns . . . :                     Edit                         GOLFP/SRCFILE
 SEU==>_______________________________________________________             C06
 FMT C* .....C*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
        *************** Beginning of data *************************************

/*	This program uses an array to help locate appartments. Each
	apartment is described in terms of 30 possible features.
	A 'Y' indicates that it has that desired feature whereas an 
	'N' indicates the opposite. CUSTOMER.dat is read and compared
	with APTS.dat and then a printed form is displayed for the 
	user. 

		Written by: Browning ©
		      Date: 06/16/99
  -------------------------------------------------------------------------
Contents of APTS.dat:
YNYNYNYNYNYNYNYNYNYNYNYNYNYNYN  1302    Coleridge Avenue
NYNYNYNYNYNYNYNYNYNYNYNYNYNYNY  2311    Avenue A West
YYYYYNNNNNYYYYYNNNNNYYYYYNNNNN  10656   Rondo Avenue
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN  111 N.  Montgomery Rd.
NNNNNYYYYYNNNNNYYYYYNNNNNYYYYY  NE 53rd Street   
  -------------------------------------------------------------------------
Contents of CUSTOMER.dat:
YYYYYNNNNNYYYYYNNNNNYYYYYNNNNN 
  -----------------------------------------------------------------------*/

#include 

int main ( void )
{
FILE *custPreference ;
FILE *aptDescription ;
char aptDesc   ;
char custPref_array[30] ;
int variable = 0 ;
int yesNo = 0 ;
char address= ' ' ;
char readTheFile ;

/*-----------------------------------------------------------------------*/

custPreference = fopen("A:\Customer.dat", "r") ;
	if(custPreference == NULL)
		{
		 printf("Customer.dat File not found on A:\.\n") ;
		 return 1 ;
		}

	for(variable = 0; variable < 30; variable++)
		{
		 fscanf(custPreference, "%c", &custPref_array[variable]) ;
		}

fclose(custPreference) ;

/*-----------------------------------------------------------------------*/

aptDescription = fopen("A:\Apts.dat", "r") ;
	  if(aptDescription == NULL)
            {
             printf("Apts.dat File not found on A:\.\n") ;
             return 1 ;
	    }


printf("		    BROWNING RENTALS                   \n");
printf("                     99 XXXXX XXXX                     \n");
printf("                 XXXXXXXXXXXX, XXXXX 99999             \n");
printf("                      217-555-1234                     \n");
printf("               Housing and Apartment Rentals         \n\n"); 
printf("     Presque Isle - Caribou - Fort Fairfield - Easton\n\n");
printf("-----------------------------------------------------------\n") ;
printf("       Apartment        Overall            Satisfactory\n") ;
printf("        Address          Score              Standing\n") ;
printf("-----------------------------------------------------------\n") ;

readTheFile = fscanf(aptDescription, "%c", &aptDesc  ) ;
            while(readTheFile != EOF)
	    {
	        if(custPref_array[0] == aptDesc  )
	          {
	          yesNo++ ;
	          }
	     for(variable = 1; variable <= 29; variable++)
	      {
	        fscanf(aptDescription, "%c", &aptDesc  ) ;
	        if(custPref_array[variable] == aptDesc  )
	        {
	        yesNo++ ;
	        }
              }
	fscanf(aptDescription, "%c", &address) ;
              while(address!= '\n')
	           {
	            printf("%c", address) ;
                    fscanf(aptDescription, "%c", &address) ;
	           }

	 printf("     %2i", yesNo) ;
			if(yesNo >= 24)
				{
				 printf("                POSSIBLE\n") ;
				}
			else if(yesNo <= 23)
				{
				 printf("                   NO\n") ;
				}
yesNo = 0 ;
address= ' ' ;
readTheFile = fscanf(aptDescription, "%c", &aptDesc  ) ;
				}
fclose(aptDescription) ;
return 0 ;
}

/*-----------------------------------------------------------------------*/


Copyright ©1998 - 2001 J. Browning - All rights reserved.
Master Menu - Links the Master Page