I've included all my code so far, I started out setting out my field then when that was looking fine commenting it out. You've lost me Adak, I think I've seen working on this too long without coffee, going to go grab one and see if it starts making sense.
Code:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#define SIZE 8 // Max. buffer size
#define RANGE 6; // Max range size for array
void bar(int number);
void space(int number);
void main()
{
FILE *rawdat;
//char buffer[SIZE];
int rangearray[6][6];
char sex, newline;
int age, range;
//int rangenum[RANGE];
rawdat = fopen("H:\\sp3work\\custsurvey.dat","r");
if (rawdat == NULL)
{
printf("Cannot locate file");
}
else
{
while (fscanf(rawdat, "%c %d %d &c", &sex, &age, &range, &newline) != EOF)
if (((sex == 'F') && (age < 25) && (range == 1)))
printf("%c %d %d\n", sex, age, range);
}
if (fclose(rawdat) == EOF)
puts("Cannot close this file");
//freopen ("H:\\sp3work\\SP3Project\\projecttext.txt","w",stdout);
//change to: \\\\student\\prn1 for printing
/*
space(28); // Start of Heading layout
printf("CUSTOMER SURVEY REPORT\n");
space(28);
bar(22);
printf("\n"); // Start of line #3
space(22);
printf("FEMALES");
space(19);
printf("MALES\n"); // End of line #3
space(14); // Start of line #4
bar(23);
space(2);
bar(23); // End of line #4
printf("\n");
space(14); // Start of line #5
printf("younger range older younger range older\n"); // End of line #5
printf("\n");
space(14); // Start of line #6
printf("than 25 25 - 40 than 40 than 25 25 - 40 than 40\n"); // End of line #6
space(4); // Start of line #7
printf("LEAD TYPE ");
bar(23);
space(2);
bar(23);
printf(" TOTAL\n"); // End of line #7
space(4); // Start of line #8
bar(9);
space(50);
bar(5); // End of line #8
printf("\n\n"); // Line #9 (used as a spacer between
// title and main
// End of heading
// Start of main
space(7);
printf("REPEAT 999 999 999 999 999 999 999\n\n");
space(0);
printf("TELEVISION AD 999 999 999 999 999 999 999\n\n");
space(1);
printf("NEWSPAPER AD 999 999 999 999 999 999 999\n\n");
space(5);
printf("RADIO AD 999 999 999 999 999 999 999\n\n");
space(0);
printf("WORD OF MOUTH 999 999 999 999 999 999 999\n\n");
space(8);
printf("OTHER 999 999 999 999 999 999 999\n\n");
space(8); bar(5); space(2); bar(4); space(4); bar(4); space(4); bar(4);
space(5); bar(4), space(4); bar(4); space(4); bar(4); space(3); bar(4);
printf("\n");
space(8);
printf("TOTAL 9999 9999 9999 9999 9999 9999 9999\n");
space(8); bar(5); space(2); bar(4); space(4); bar(4); space(4); bar(4);
space(5); bar(4), space(4); bar(4); space(4); bar(4); space(3); bar(4);
//fclose (stdout);
*/
printf("\n\n\nPress any key to continue");
getch();
}
void bar(int number)
{
int count = 0;
for (count = 1; count <= number; count++)
putchar('=');
}
void space(int number)
{
int count = 0;
for (count = 1; count <= number; count++)
putchar(' ');
}